Jump to content

Give new value to variable from MYSQL UPDATE statement


nightkarnation

Recommended Posts

Please take a look at the following code (this would work if the statement was SELECT instead of UPDATE) But I need to grab the following:

 

$result = mysql_query("UPDATE `AUCTIONS_MAIN` SET Current_Price = Current_Price + '$increase_price', Last_Bidder_Time = '$last_bidder_time' WHERE PId = '$id'");
//grab the new updated current price to save on different bidding history DB
 while($row=mysql_fetch_array($result))
{
	$current_price = $row['Current_Price'];
   	}

 

As you can see, I need to give the new Current_Price value to the $current_price variable.

Obviously the while function is incorrect,

I would really appreciate any ideas and/or suggestions on how I can grab this value.

 

PS: I can't make a new query call with a select statement in order to know the new Current_Price. I need the direct updated value coming from the Update Statement, is this possible?

 

Thanks a lot in advance!!

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.