renfley Posted May 12, 2013 Share Posted May 12, 2013 Hey guys i need help with a simple query and cant seem to figure it out... Im pretty sure it has to do with the double quote but cant mysql_connect("localhost", "host", "Sunadan86") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); mysql_query("INSERT INTO tickets (trouble_report, customer_number, customer_#, rrli, owner, active, key_symptoms, resolution) VALUES ($tr, $phone, $b1, $clli, $owner, $active, $symptoms, $description")) or die(mysql_error()); //echo "Data Inserted!"; header( 'Location: renfley/www/?page=success' ); mysql_close($con); Quote Link to comment Share on other sites More sharing options...
Solution jazzman1 Posted May 12, 2013 Solution Share Posted May 12, 2013 You need to quote the values which type of data is not integer. Something like: mysql_query("INSERT INTO tickets (trouble_report, customer_number, customer_#, rrli, owner, active, key_symptoms, resolution) VALUES ('$tr', '$phone', etc.....")) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 12, 2013 Share Posted May 12, 2013 you will also need to enclose customer_# column name in back-ticks as the # isn't normally permitted in an identifier - `customer_#` Quote Link to comment Share on other sites More sharing options...
Barand Posted May 12, 2013 Share Posted May 12, 2013 plus your final double quote needs moving. But you'd get a clue from the error messages displayed by mysql_error(), wouldn't you? Quote Link to comment Share on other sites More sharing options...
renfley Posted May 12, 2013 Author Share Posted May 12, 2013 Thanks Jazzman... Fixed her right up, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.