Jump to content

Strange update error


karthik.v29

Recommended Posts

Hello guys,

I have these lines of code

echo $_POST['uteamid'];

$iddquery1 = mysql_query("Select Driver_ID from Driver where Driver_Name='".$temp."'");

$result = mysql_fetch_assoc($iddquery1);

$idquery2 =mysql_query("Select Driver_ID from Driver where Driver_Name='".$_POST['DriverSubst']."'");

$resultidquery2 = mysql_fetch_assoc($idquery2);

$replaceid = $result['Driver_ID'];

echo $replaceid;

$updatequery2 = "Update Team_Driver SET Driver_ID = '".$resultidquery2['Driver_ID']."' where UTeam_ID='".$_POST['uteamid']."' and Driver_ID='".$replaceid."'";

echo $updatequery2;

 

Output of the query is:

 

5

1

Update Team_Driver SET Driver_ID = '2' where UTeam_ID='5' and Driver_ID=''

Why is that last Driver_ID = null?

wen it should be 1..and its echoing 1 right before that line.

Any help will be appreciated

Link to comment
Share on other sites

Code seems fine to me too. Anyway try

$updatequery2 = "Update Team_Driver SET 
Driver_ID = '".$resultidquery2['Driver_ID']."' 
where UTeam_ID='".$_POST['uteamid']."' and Driver_ID='$replaceid'";

Even though there is no difference..

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.