Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update a field in mysql table 1

Status
Not open for further replies.

4x4uk

Technical User
Apr 30, 2002
381
GB
I want to retrieve all of the values in a field on a table, modify the value and insert it into another field in the table.
I have got this far but am not sure what to do next

$sql="SELECT (field1) FROM $dbsql ORDER BY id";
$results =mysql_query($sql);
while ($myrow=mysql_fetch_array($results)){
$oldvalue=$myrow["field1"];
$newvalue= $oldvalue*2;
}
Any suggestions
Thanks
Ian It's not a lie if you believe it!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top