Newbie question

From: Date: Wed, 09 Jan 2002 19:54:17 +0000
Subject: Newbie question
Groups: php.general 
Request: Send a blank email to php-general+get-79950@lists.php.net to get a copy of this message
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

« previous php.general (#79950) next »