snorky Posted June 26, 2009 Share Posted June 26, 2009 Using an HTML form to input data. <form action='newa.php'> The query in newa.php: $result= mysql_query("insert into main (bldg,lname,title,fname) values ($bldg,$lname,$title,$fname)") or die('Oopsie! ' . mysql_error()); The result: Record not posted. mysql_error(): Unknown column 'Warehouse' in 'field list' "Warehouse" is the value input for bldg. However, if I shuffle the order of the fields and values so that (for example) fname comes before bldg "insert into main (fname,bldg,lname,title) values ($fname,$bldg,$lname,$title)" the the error is Unknown column 'George' in 'field list' and so on... Whichever field/value are first in the list, the "unknown column" is the value of the data in that column. there are several more fields - no matter what combinations I use, the result is the same. As a sanity check, I added code to echo the values. Those are always correct, no matter which order is in the code. No, I have not been self-medicating today. Link to comment https://forums.phpfreaks.com/topic/163821-mysql_query-very-strange-results/ Share on other sites More sharing options...
SetToLoki Posted June 26, 2009 Share Posted June 26, 2009 $result= mysql_query("insert into main (bldg,lname,title,fname) values '$bldg','$lname','$title','$fname'") or die('Oopsie! ' . mysql_error()); Link to comment https://forums.phpfreaks.com/topic/163821-mysql_query-very-strange-results/#findComment-864361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.