brucegregory Posted June 21, 2012 Share Posted June 21, 2012 I know their is an error somewhere in this code, but I have looked for hours and found a few syntax errors. My code will not give back any errors, it will just simply not insert into the database. If you see anything please let me know. Thanks! <?php session_start(); $username=$_SESSION['username']; if($username==''){ header("location:http://192.168.2.2/login.php"); } $con = mysql_connect("localhost","root","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); mysql_query("INSERT INTO quote_sheet (customer, attn, phone, fax, date, part, description, material, shipping, exceptions, tool_deliver_qty, tool_delivery_price, production_delivery_qty, production_delivery_price, other01, other02, other03, quoted_by, grams, surf_area, tons, density, lbs_min_parts, vsp1, lbs_mil_min, percent1, percent3, vsp2, ton_press2, pcs_hour1, pcs_hour2, sintered1, sintered2, sec_1, sec_2, sec_3, sec_4, sec_5, sec_6, sec_7, sec_8, set_up_charges, manu_costs, comm, tool, spec, lbs_mil_min2 ) VALUES ('$_POST[customer]','$_POST[attn]','$_POST[phone]', '$_POST[fax]', '$_POST[date]','$_POST[part]', '$_POST[description]', '$_POST[material]','$_POST[shipping]', '$_POST[exceptions]', '$_POST[tool_delivery_qty]','$_POST[tool_delivery_price]', '$_POST[production_delivery_qty]', '$_POST[production_delivery_price]','$_POST[other01]', '$_POST[other02]', '$_POST[other03]','$_POST[quoted_by]', '$_POST[grams]', '$_POST[surf_area]','$_POST[tons]', '$_POST[density]', '$_POST[lbs_mil_parts]','$_POST[vsp1]', '$_POST[lbs_mil_min]', '$_POST[percent1]', '$_POST[percent3]', '$_POST[vsp2]','$_POST[ton_press2]', '$_POST[pcs_hour2]', '$_POST[sintered1]','$_POST[sintered2]', '$_POST[sec_1]', '$_POST[sec_2]','$_POST[sec_3]', '$_POST[sec_4]', '$_POST[sec_5]','$_POST[sec_6]', '$_POST[sec_7]', '$_POST[sec_8]','$_POST[set_up_charges]', '$_POST[manu_costs]', '$_POST[comm]', '$_POST[tool]', '$_POST[spec]', '$_POST[lbs_mil_min2]'"); mysql_close($con); echo 'Quote Successfully Inserted'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/264552-php-will-not-insert-my-data-into-mysql/ Share on other sites More sharing options...
Barand Posted June 21, 2012 Share Posted June 21, 2012 check for error mysql_query("blah blah") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/264552-php-will-not-insert-my-data-into-mysql/#findComment-1355880 Share on other sites More sharing options...
boompa Posted June 21, 2012 Share Posted June 21, 2012 And please look into protecting yourself against SQL injection. Quote Link to comment https://forums.phpfreaks.com/topic/264552-php-will-not-insert-my-data-into-mysql/#findComment-1355898 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.