I am getting the following from the mysql_error():
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 –>’assets’ (‘assetid’ INT UNSIGNED NOT NULL AUTO_INCREMENT , PRIMARY KEY(‘assetid'<– at line 1
I’ve also tried something like this :
'assets' ('assetid' INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
…but with no luck. The mysql version is 5.0.7.
EDIT:
Actually, I’ve tried it without (‘) first before putting it. The code is dynamic, but these are the examples:
CREATE TABLE 'assets' (
'assetid' INT UNSIGNED NOT NULL AUTO_INCREMENT,
PRIMARY KEY('assetid'),
'rfid' VARCHAR( 128 ) ,
'createddate' DATE ,
'modifieddate' DATE ,
'curlocid' INT( 11 ) ,
'type' VARCHAR( 128 ) ,
'brand' VARCHAR( 128 ) ,
'name' VARCHAR( 128 ) ,
'condition' VARCHAR( 128 )
);
EDIT 2:
Just now I tried changing all the single quotes ( ‘ ) with back ticks ( ` ).. Other error occurred..
Can’t create table ‘mydb.assets’ (errno: 121)
Is this better or worse?
EDIT 3:
I tried to create it using different table names and guess what? It works! Gosh, why can’t I create table name ‘assets’?? is it because there is some leftovers for previous operation?? if so how to I clean it?? what if i said that i delete the table by deleting it’s file??(frm,myd,myi)(not drop it, due to laziness).. how do i fix it?
This question is old but I just going to tell the answer on how to resolve this. In case someone stumbled upon it.. In this case, it’s the default ENGINE that is used. I haven’t noticed it until now, that the server i’m using (Z-WAMP) configure INNODB as it’s default engine. After I changed it to MyISAM, which is the default engine for mysql, everything works perfectly!! however, thanks for the guys who are helping me out..
In this file –> my.cnf, change this line: