Welcome Guest, Not a member yet? Register   Sign In
Database Backup with Reserved Keyword

The Bug

I found this error when trying to backup my database:

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order' at line 1


This is because one of my table names ("Order") is a mysql reserved word. This broke the database backup. If I deleted this table the problem went away.

I went digging in the code and found where the problem was:

The Fix

If you check out line 132 of mysql_utility in system/database/drivers/mysql - This line appears:

$query = $this->db->query("SELECT * FROM $table");
Changing it to

$query = $this->db->query("SELECT * FROM `$table`");

Fixes the problem mentioned above.


So what should I do next?

Theme © iAndrew 2016 - Forum software by © MyBB