I am trying to alter every value in a column via an SQL Query by adding a number to the current value. If that makes sense .
Example: If a field contained the number '2' once the query was ran the field would contain the number '3' and then when ran again number '4'. I have tried using:
$result = mysql_query("select * from ships");
while($r=mysql_fetch_array($result))
{
$time=$r["time"];
$newtime = ($time - "1");
$timesql = "UPDATE ships SET time='$newtime'";
$timeresult = mysql_query($timesql);
This simply changes every field in the 'time' column to the value of the first field minus 1.
Any help would be appreciated. As far as I am aware I am probably not using the correct SQL query.
Thaks in advance.
Matt.