The problem is here: $nfl_player_id = mysql_query("SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'");
mysql_query does not return the ID, but the handle of the connection. What you need to do is fetch the results that the query has generated. You can replace the above code with this one: //start $result = mysql_query("SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'"); $row_id=mysql_fetch_array($result); $nfl_player_id = $row_id[0]; //end This will get you the right ID and should allow to do the update, unless there are other pbs :) Sincerely, Pavel Kharitonov Project Manager Intechnic Corporation http://www.intechnic.com Phone: (847) 816-1231 -----Original Message----- From: Bob Eldred [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: [PHP] Newbie question Hi there, I'm really really new to both PHP and MySQL, so this is probably going to turn out to be an easy fix. The basis is this: I have a MySQL database with two tables in it. I'm trying to update 1 of the fields (aqfl_team) in the first table (nfl_players) with a value from a field (aqfl_team) from the second table (temp_aqfl_rosters). The PHP document looks like this: <html> <body> <?php $db = mysql_connect("localhost","root","password"); mysql_select_db("aqfl",$db); $aqfl_result = mysql_query("SELECT * FROM temp_aqfl_rosters"); echo "Updating rosters....."; $myrow = mysql_fetch_array($aqfl_result); do { $aqfl_player_first = $myrow["first_name"]; $aqfl_player_last = $myrow["last_name"]; $aqfl_player_position = $myrow["position"]; $aqfl_player_nfl_team = $myrow["nfl_team"]; $aqfl_player_aqfl_team = $myrow["aqfl_team"]; $nfl_player_id = mysql_query("SELECT player_id FROM nfl_players WHERE first_name='$aqfl_player_first' AND last_name='$aqfl_player_last' AND position='$aqfl_player_position' AND nfl_team='$aqfl_player_nfl_team'"); $result = mysql_query("UPDATE nfl_players SET aqfl_team='$aqfl_player_aqfl_team' WHERE player_id='$nfl_player_id'"); echo "$aqfl_player_first $aqfl_player_last updated ($aqfl_player_position, $aqfl_player_nfl_team, $aqfl_player_aqfl_team)"; } while ($myrow = mysql_fetch_array($aqfl_result)); ?> </body> </html> The end result is that I get a screenful of data (every player, NFL team, and AQFL team is correct) stating that the various players are updated, but but the field update in nfl_players is not actually done. I'm sure it's a syntax issue, but I don't know what's the actual problem. Any help? Thanks, Bob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]