CodeIgniter Forums
Database error 1064 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Database error 1064 (/showthread.php?tid=64962)



Database error 1064 - koficypher - 04-14-2016

i added a ci_session table to my database with the code i found in the codeigniter user guide. i then changed the session driver to database and added a function to my model_user.php to set session anytime a user finishes registering.i also tried bacticking the table name and columns in the sql query i used in my set_session function . i then tried loading my registration form and this is what i got:

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 'WHERE `id` = 'c9760afa0b1a5b45a08b54dd428af1afe3b837f3'' at line 2
SELECT `data` WHERE `id` = 'c9760afa0b1a5b45a08b54dd428af1afe3b837f3'
Filename: C:/wamp/www/busticket/system/database/DB_driver.php
Line Number: 691
 Any help please?


RE: Database error 1064 - Happy Camper - 04-14-2016

Hi

I had a similar issue a while ago. I think just make sure the DB table is empty fixed it for me. Hope this helps. Sorry to be so vague!


RE: Database error 1064 - gxgpet - 04-14-2016

(04-14-2016, 11:25 AM)koficypher Wrote: i added a ci_session table to my database with the code i found in the codeigniter user guide. i then changed the session driver to database and added a function to my model_user.php to set session anytime a user finishes registering.i also tried bacticking the table name and columns in the sql query i used in my set_session function . i then tried loading my registration form and this is what i got:

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 'WHERE `id` = 'c9760afa0b1a5b45a08b54dd428af1afe3b837f3'' at line 2
SELECT `data` WHERE `id` = 'c9760afa0b1a5b45a08b54dd428af1afe3b837f3'
Filename: C:/wamp/www/busticket/system/database/DB_driver.php
Line Number: 691
 Any help please?


Hello!  Smile

As you can see from the query, CodeIgniter doesn't know how is your table named. Open your application/config/config.php, then add the following line:

PHP Code:
$config['sess_save_path'] = 'ci_sessions'

Hope this helps!


RE: Database error 1064 - arma7x - 04-14-2016

In config.php file, look for $config['sess_save_path'] and replace NULL with your session table name.