kyleldi Posted March 11, 2009 Share Posted March 11, 2009 For some reason my process file for my form will no longer insert data into the db, even though it connects properly. Any ideas? Here's my code: $link = mysql_connect($db_host,$db_user,$db_pass); if(!$link) die ('Could not connect to database: '.mysql_error()); mysql_select_db($db_name,$link); $query = "INSERT into `".$db_table."` (date,company,name,email,instructions,material,tolerances_holes,tolerances_hole_hole,tolerances_profile,quantity,rfq_due_date,file01,file02,file03,file04,file05,originating_ip) values ('".$date."','".$company."','".$name."','".$email."','".$instructions."','".$material."','".$tolerances_holes."','".$tolerances_hole_hole."','".$tolerances_profile."','".$quantity."','".$rfq_due_date."','".$where_form_is."$dirname/".$image_list[14]."','".$where_form_is."$dirname/".$image_list[15]."','".$where_form_is."$dirname/".$image_list[16]."','".$where_form_is."$dirname/".$image_list[17]."','".$where_form_is."$dirname/".$image_list[18]."','".$originating_ip."')"; mysql_query($query); mysql_close($link); Thank You! Link to comment https://forums.phpfreaks.com/topic/148994-solved-php-insert-record-problem/ Share on other sites More sharing options...
premiso Posted March 11, 2009 Share Posted March 11, 2009 mysql_query($query) or die("SQL WAS {$query}<br />Error Was:" . mysql_error()); Replace that line and report back the error (if any). Link to comment https://forums.phpfreaks.com/topic/148994-solved-php-insert-record-problem/#findComment-782326 Share on other sites More sharing options...
kyleldi Posted March 11, 2009 Author Share Posted March 11, 2009 SQL WAS INSERT into `quotes` (date,company,name,email,instructions,material,tolerances_holes,tolerances_hole_hole,tolerances_profile,quantity,rfq_due_date,file01,file02,file03,file04,file05,originating_ip) values ('March 11, 2009','LDI','Kyle','[email protected]','test test test','','0.005\" - 0.010\"','< 0.005\"','< 0.005\"','102','now','http://Kyle/Google Maps API TLC.pdf','http://kyle/Google Maps API - API Key S...pdf','http://Kyle/gallery-update.xls','http://Kyle/fpdf16.zip','http://Kyle/form.zip','72.35.35.2') Error Was:Unknown column 'name' in 'field list' I just filled the form in with a bunch of garbage to get an output Link to comment https://forums.phpfreaks.com/topic/148994-solved-php-insert-record-problem/#findComment-782331 Share on other sites More sharing options...
premiso Posted March 11, 2009 Share Posted March 11, 2009 Looks like you got it. Link to comment https://forums.phpfreaks.com/topic/148994-solved-php-insert-record-problem/#findComment-782363 Share on other sites More sharing options...
redarrow Posted March 11, 2009 Share Posted March 11, 2009 Always use mysql_real_escape_string() when inserting anything in a database. or you differently have garbage in it. Link to comment https://forums.phpfreaks.com/topic/148994-solved-php-insert-record-problem/#findComment-782384 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.