maxudaskin Posted July 25, 2007 Share Posted July 25, 2007 Can someone tellme why I get the following error? Error: Unknown column 'OOM210' in 'field list' $flightnumber is equal to OOM210... (INSERT INTO and VALUES are on the same line, but here it is split so it is easier to compare.) $sql = "INSERT INTO flights (flight_num, dept, dest, depticao, desticao, depttime, desttime, stops, duration, freq) VALUES ($flightnumber,$departure,$destination,$departurecity,$destinationcity,$departuretime,$arrivaltime,$stop,$duration,$freq)"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } Quote Link to comment Share on other sites More sharing options...
trq Posted July 25, 2007 Share Posted July 25, 2007 Your values need to be surrounded by single quotes. Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 25, 2007 Author Share Posted July 25, 2007 Like this: NSERT INTO flights ("flight_num, dept, dest, depticao, desticao, depttime, desttime, stops, duration, freq") Quote Link to comment Share on other sites More sharing options...
micah1701 Posted July 25, 2007 Share Posted July 25, 2007 because your values aren't in quotes. its looking for a column named 00M210 not trying to save the value '00M210' you need something like this: "INSERT INTO flights (flight_num, dept, dest, depticao, desticao, depttime, desttime, stops, duration, freq) VALUES ('$flightnumber','$departure','$destination','$departurecity','$destinationcity', '$departuretime','$arrivaltime','$stop','$duration','$freq')"; Quote Link to comment Share on other sites More sharing options...
maxudaskin Posted July 25, 2007 Author Share Posted July 25, 2007 Thanx 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.