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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.