I am trying to insert some data into a database, and am getting "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 'Pawn_Num='1', Pawn_Port='LW3', Pawn_Path='\\\\PS1\\LPT1', Pawn_Mod='', Rec_Num='' at line 1" My code is as follows: mysql_query("INSERT INTO printers SET cust_no='$cust_no' Pawn_Num='$Pawn_Num', Pawn_Port='$Pawn_Port', Pawn_Path='$Pawn_Path', Pawn_Mod='$Pawn_Mod', Rec_Num='$Rec_Num', Rec_Port='$Rec_Port', Rec_Path='$Rec_Path', Rec_Mod='$Rec_Mod', Rep_Num='$Rep_Num', Rep_Port='$Rep_Port', Rep_Path='$Rep_Path', Rep_Mod='$Rep_Mod', Lab_Num='$Lab_Num', Lab_Port='$Lab_Port', Lab_Path='$Lab_Path', Lab_Mod='$Lab_Mod', Jew_Num='$Jew_Num', Jew_Port='$Jew_Port', Jew_Path='$Jew_Path', Jew_Mod='$Jew_Mod'") or die(mysql_error()); PHP: does anyone have any idea what i'm doing wrong here? Thanks in advance!
i think the best possibility is that you should check the structure of your database please check whthere the name is correct hope this helps /d
My suggestion is that you assign the SQL to a string, echo the string, and then try to run the generated SQL in phpmyadmin. You may thus be able to diagnose the problem more easily. $sqlstring ="INSERT INTO printers SET cust_no='$cust_no' ..."; echo $sqlstring; die();