HELP!Error Number: 1064

hi im just new using code igniter wondering why this error occur my mysql version is 5.0.37 do i need to configure something else?

An Error Was Encountered

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 'desc, url, category, size, date) VALUES ('Bae Seul Ki 3rd Single ', 'http://www.' at line 1

INSERT INTO download (desc, url, category, size, date) VALUES ('Bae Seul Ki 3rd Single ', '', 'Korean Performance', '', 'Feb-06-2008')
i only use this code to insert data just like what the tutorial said. but i get the errors above
it also occur in the scaffolding process insert and update

hoping for your kind reply thx

problem is very simple
the field name desc is a reserved word in mysql (and every other database platform for that matter)
so you need to backtick the name

if you are writing the insert query yourself then you need to change it to
INSERT INTO download (`desc`, url, category, size, `date`) VALUES ...
note you will have to do date as well, might just be safest to do all the field names
If you are using the active record CI methods to build the insert then it should backtick for you automatically

[eluser]Derek Allard[/eluser]
Hey jigen7. Take a look at the Input library for some uses of post().

And welcome to CodeIgniter!


lol i forgot its a reserve word thx man for reminding well i really have fun using codeigniter lol thx

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.