Unknown column 'Bob' in 'field list'… php or mysql problem

oiloiloil

New Member
I have a curious problem that I hope is something stupid I overlooked.I am getting an error that usually occurs when there is a missing column in a mysql table, or a misspelled php variable: "Unknown column 'Bob' in 'field list'"...Except 'Bob' is not the name of a column, its the VALUE I am trying to assign to the row. Why would php be confusing the two??Here is my php function that I believe is the location of the error:\[code\]function recordGuest($id,$fname,$lname,$dinner){ $conn = connect("wedding"); $guest_query = "INSERT INTO guest (fname,lname,person_id) VALUES (".$fname.",".$lname.",".$id.");"; mysql_query($guest_query,$conn) or die(mysql_error()); $guest_id_query = "SELECT id FROM guest WHERE person_id = ".$id.";"; $guest_id_result = mysql_query($guest_id_query,$conn) or die(mysql_error()); $guest_id = ""; while($row = mysql_fetch_array($guest_id_result)){ $guest_id = $row["id"]; } $guest_dinner_query = " INSERT INTO guest_dinner (dinner_id,guest_id) VALUES (".$dinner.",".$guest_id.");"; mysql_query($guest_dinner_query,$conn) or die(mysql_error());}\[/code\]Here is the php code that processes the form and executes the above function:\[code\]<?phpinclude("functions.php");$code = $_POST["code"];$type = $_POST["type"];$people = getPeople($code);$ids = $people["ids"];$email= "";for($i = 0; $i < count($ids); $i++){ $response = $_POST["response_".$i]; $dinner = $_POST["dinner_".$i]; recordResponse($ids[$i],$response); if($dinner != "null"){ recordDinner($ids[$i],$dinner); } if($type == 3){ $guest_responses = $_POST["guest_response_".$i]; $guest_fname = $_POST["guest_fname_".$i]; $guest_lname = $_POST["guest_lname_".$i]; $guest_dinner_response = $_POST["guest_dinner_response_".$i]; if($guest_dinner_response != "null"){ recordGuest($ids[$i],$guest_fname,$guest_lname,$guest_dinner_response); } }}?>\[/code\]Heres what my "guest" mysql table looks like:\[code\]guest id int auto inc (primary key) fname varchar lname varchar person_id int\[/code\]Any help would be appreciated.
 
Back
Top