Jump to content

[SOLVED] query help needed please


j4ymf

Recommended Posts

hello folks

 

i run a fantasy football website.

 

i have this query at the moment and all ive been doing is updating the points. but now i want to update the teams and the player names.

 


   // Check the 'dreamteam' table for the Player ID

   $sql = "SELECT id FROM dreamteam WHERE id = '$player_id'";

   $result = mysql_query($sql) or die("Error 02: Failed to check Player ID");

   if ($found = mysql_fetch_assoc($result)) {

    // If the player exists, update the points and update flag

       $sql = "UPDATE dreamteam SET points = $player_points, UPDATE_FLAG = 'Y' WHERE id = '$player_id'";
	   
   //echo "<P>@@@: " . $sql;
    $update = mysql_query($sql) or die("Error 03: Failed to update Player $player_id");

   }

   else {

 

 

 

i tried this but it cant be the right way to do it

 


   // Check the 'dreamteam' table for the Player ID

   $sql = "SELECT id FROM dreamteam WHERE id = '$player_id'";

   $result = mysql_query($sql) or die("Error 02: Failed to check Player ID");

   if ($found = mysql_fetch_assoc($result)) {

    // If the player exists, update the points and update flag

       $sql = "UPDATE dreamteam SET points = $player_points, UPDATE_FLAG = 'Y' WHERE id = '$player_id'";
     $sql .= "UPDATE dreamteam SET name = $player_name, UPDATE_FLAG = 'Y' WHERE id = '$player_id'";
       $sql .= "UPDATE dreamteam SET team = $player_team, UPDATE_FLAG = 'Y' WHERE id = '$player_id'";
   
   //echo "<P>@@@: " . $sql;
    $update = mysql_query($sql) or die("Error 03: Failed to update Player $player_id");

   }

   else {

 

 

please point me in the right direction

many thanks jason

Link to comment
https://forums.phpfreaks.com/topic/169143-solved-query-help-needed-please/
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.