nightkarnation Posted April 13, 2011 Share Posted April 13, 2011 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 https://forums.phpfreaks.com/topic/233622-give-new-value-to-variable-from-mysql-update-statement/ Share on other sites More sharing options...
drisate Posted April 13, 2011 Share Posted April 13, 2011 I really don't understand what your trying to do ... Post your code as it is now ... and ask your question cause that UPDATE as a SELECT is confusing me ... it's wrong in so many ways ! Anybody else understand? Link to comment https://forums.phpfreaks.com/topic/233622-give-new-value-to-variable-from-mysql-update-statement/#findComment-1201215 Share on other sites More sharing options...
dcro2 Posted April 13, 2011 Share Posted April 13, 2011 Simply put, it's not gonna happen. mysql_query won't return a result unless it's a SELECT query (or SHOW, DESCRIBE, EXPLAIN). I don't understand why you can't just SELECT the row to get the new price. Link to comment https://forums.phpfreaks.com/topic/233622-give-new-value-to-variable-from-mysql-update-statement/#findComment-1201221 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.