Jump to content

[SOLVED] MySQL Mess up...


maxudaskin

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.