Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Backup and Import not working #2232

teseo-2014 opened this issue Oct 15, 2017 · 0 comments


Copy link

commented Oct 15, 2017


1.- Tools / Backup data:

Created .sql won't include TRUNCATE of already existent tables, so any INSERT will fail on Import.

Suggested solution:


        foreach($result as $_line) {
            $_str .= str_replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS', $_line['Create Table'] . ';');
            $_str .= "\n\n";
            $_str .= "TRUNCATE TABLE `" . $table . "`;";
            $_str .= "\n\n";

2.- Tools / Import data

Seems that any semicolon in the .sql file is being interpreted as the end of a MySQL command, so fields values including a semicolon will provoke an error. For this I've found a solution that seems to work:


$queries = $this->splitSQL($sql, ';');

$queries = $this->splitSQL($sql, ';'.PHP_EOL);

Thanks for your attention, best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.