Need help with updating existing mysql records with something else

From: Date: Fri, 11 Nov 2011 05:43:57 +0000
Subject: Need help with updating existing mysql records with something else
Groups: php.db 
Request: Send a blank email to php-db+get-48089@lists.php.net to get a copy of this message
Hi All, I want to update an existing mysql record with another value after calculating it. Below is the code. <?php $connection = mysql_connect("localhost", "root", "") or die("Error connecting to database"); mysql_select_db("maha", $connection); $result = mysql_query("SELECT * FROM tax", $connection) or die("error querying database"); $i = 0; while($result_ar = mysql_fetch_assoc($result)){ ?> <tr <?php if($i%2 == 1){ echo "class='body2'"; }else{echo "class='body1'";}?>> <td> <?php $res=$result_ar['mwool40_totqty']-10; echo $res; ?></td> </tr> <?php $i+=1; } ?> I want to append the $mwool40_totqty value with the calculated one "$res". Let say initially the value of $mwool40_totqty is 50. and after calculation its value became 40, then the code should edit/alter/update the value in mysql table with integer 40. Please help me with this. -- *Best, * *Guru™*

« previous php.db (#48089) next »