Need help with updating existing mysql records with something else

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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™*

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux