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); Link to comment https://forums.phpfreaks.com/topic/277933-need-help-with-my-query-something-doesnt-work/ Share on other sites More sharing options...
jazzman1 Posted May 12, 2013 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()); Link to comment https://forums.phpfreaks.com/topic/277933-need-help-with-my-query-something-doesnt-work/#findComment-1429748 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_#` Link to comment https://forums.phpfreaks.com/topic/277933-need-help-with-my-query-something-doesnt-work/#findComment-1429750 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? Link to comment https://forums.phpfreaks.com/topic/277933-need-help-with-my-query-something-doesnt-work/#findComment-1429753 Share on other sites More sharing options...
renfley Posted May 12, 2013 Author Share Posted May 12, 2013 Thanks Jazzman... Fixed her right up, Link to comment https://forums.phpfreaks.com/topic/277933-need-help-with-my-query-something-doesnt-work/#findComment-1429760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.