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()); } Link to comment https://forums.phpfreaks.com/topic/61647-solved-mysql-mess-up/ 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. Link to comment https://forums.phpfreaks.com/topic/61647-solved-mysql-mess-up/#findComment-306850 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") Link to comment https://forums.phpfreaks.com/topic/61647-solved-mysql-mess-up/#findComment-306852 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')"; Link to comment https://forums.phpfreaks.com/topic/61647-solved-mysql-mess-up/#findComment-306854 Share on other sites More sharing options...
maxudaskin Posted July 25, 2007 Author Share Posted July 25, 2007 Thanx Link to comment https://forums.phpfreaks.com/topic/61647-solved-mysql-mess-up/#findComment-306857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.