Hi All,
I was wondering about a few things.
1. Is it possible to upload all the products, descriptions etc offline (local server using xampp) then set up opencart on live server via ftp and restore the database to get the shop loaded and ready to go?
2. How to back up the database?
I have tried admin/configuration/backup-restore. Got an error as below
Error: Unknown database ''opencart'
Error No: 1049
SHOW TABLES FROM `'opencart`
3. Is there a step by step guide to show the above 2 points on how it is done?
Thanks in advance!
Vimal.
I was wondering about a few things.
1. Is it possible to upload all the products, descriptions etc offline (local server using xampp) then set up opencart on live server via ftp and restore the database to get the shop loaded and ready to go?
2. How to back up the database?
I have tried admin/configuration/backup-restore. Got an error as below
Error: Unknown database ''opencart'
Error No: 1049
SHOW TABLES FROM `'opencart`
3. Is there a step by step guide to show the above 2 points on how it is done?
Thanks in advance!
Vimal.
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
2. How to back up the database?
I have tried admin/configuration/backup-restore. Got an error as below
Error: Unknown database ''opencart'
Error No: 1049
SHOW TABLES FROM `'opencart`
yep, you can do a restore from local to live (this is what i do)
and yep you need to apply a small fix to solve the above database backup error,
i will see if i can dig out the post that tells you how to fix it (for the live of me i cannot remember just at the min)
its not much its just a removal of an additional quote ' inside one of the files.
I have tried admin/configuration/backup-restore. Got an error as below
Error: Unknown database ''opencart'
Error No: 1049
SHOW TABLES FROM `'opencart`
yep, you can do a restore from local to live (this is what i do)
and yep you need to apply a small fix to solve the above database backup error,
i will see if i can dig out the post that tells you how to fix it (for the live of me i cannot remember just at the min)
its not much its just a removal of an additional quote ' inside one of the files.
Error: Access denied for user 'username'@'hostname' to database ''databasename'
Error No: 1044
SHOW TABLES FROM `'databasename`
However, a quick look at /admin/model/tool/backup.php revealed a single quote that simply needed to be removed, to make the Backup function work (for me). I changed Line 16 from...
Code: Select all
$table_query = $this->db->query("SHOW TABLES FROM `'" . DB_DATABASE . "`");
to...
Code: Select all
$table_query = $this->db->query("SHOW TABLES FROM `" . DB_DATABASE . "`");
Note the extra single quote just before " . DB_DATABASE
now with the database, all i did was set-up the local server with a new database, backup from the live, and restore to the local. using the admin interface. (someone may have a better way i dunno) but this is what i do and it seems to work for me.
you could also look at the import and export plug-in
you could also look at the import and export plug-in
Hi nzjolly
Thanks for your reply. I checked the solution that you suggested. I don't have an extra quote. So the file is correct.
I think the errors are different. Mine is 1049 and the solution is for 1044
Thanks for your reply. I checked the solution that you suggested. I don't have an extra quote. So the file is correct.
I think the errors are different. Mine is 1049 and the solution is for 1044
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
If it is of any help, I am using this admin/model/tool/backup.php file, with some fixes, for OpenCart 1.3.2:
Code: Select all
<?php
class ModelToolBackup extends Model {
public function restore($sql) {
foreach (explode(";\n", $sql) as $sql) {
$sql = trim($sql);
if ($sql) {
$this->db->query($sql);
}
}
}
public function backup() {
$output = '';
$table_query = $this->db->query("SHOW TABLES FROM `" . DB_DATABASE ."`");
foreach ($table_query->rows as $table) {
if (DB_PREFIX) {
if (strpos($table['Tables_in_' . DB_DATABASE], DB_PREFIX) === FALSE) {
$status = FALSE;
} else {
$status = TRUE;
}
} else {
$status = TRUE;
}
if ($status) {
$output .= 'TRUNCATE TABLE `' . $table['Tables_in_' . DB_DATABASE] . '`;' . "\n\n";
$query = $this->db->query("SELECT * FROM `" . $table['Tables_in_' . DB_DATABASE] . "`");
foreach ($query->rows as $result) {
$fields = '';
foreach (array_keys($result) as $value) {
$fields .= '`' . $value . '`, ';
}
$values = '';
foreach (array_values($result) as $value) {
$value = str_replace(array("\x00", "\x0a", "\x0d", "\x1a"), array('\0', '\n', '\r', '\Z'), $value);
$value = str_replace(array("\n", "\r", "\t"), array('\n', '\r', '\t'), $value);
$value = str_replace('\\', '\\\\', $value);
$value = str_replace('\'', '\\\'', $value);
$value = str_replace('\\\n', '\n', $value);
$value = str_replace('\\\r', '\r', $value);
$value = str_replace('\\\t', '\t', $value);
$values .= '\'' . $value . '\', ';
}
$output .= 'INSERT INTO `' . $table['Tables_in_' . DB_DATABASE] . '` (' . preg_replace('/, $/', '', $fields) . ') VALUES (' . preg_replace('/, $/', '', $values) . ');' . "\n";
}
$output .= "\n\n";
}
}
return $output;
}
}
?>
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Thank you so much JNeuhoff. It works like charm!!
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Removing the extra quote in the backup.php file worked for me!
LoveMoissanite.com - Moissanite Rings - Proudly Powered by Opencart
[How To] Speed Up Page Content with Opencart - Opencart advocate since 2009
I have done restore and it overwrites. So the new info is lost. It reverts back to your restored file.
www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel
Who is online
Users browsing this forum: No registered users and 135 guests