altering MySQL table value.
Posted: Tue Dec 30, 2003 10:48 am
uh, how do i alter a table value? for example:
id | value
----------------
1 | 5
2 | 9
3 | 2
say i want a value to increase by 1, in this case the value of id 2, then display the new value.
I wrote this code which gets the id and value, but how do i increase the value by one?
please help, thanks.
id | value
----------------
1 | 5
2 | 9
3 | 2
say i want a value to increase by 1, in this case the value of id 2, then display the new value.
I wrote this code which gets the id and value, but how do i increase the value by one?
Code: Select all
<html><head><title>Page</title></head>
<body>
<?php
$conn=mysql_connect("localhost","shaun","squall")
or die("Could not conect");
$rs = mysql_select_db("game", $conn)
or die("couldnt select database");
$sql="select id,strength from game where id=$_GET[id]";
$rs=mysql_query($sql,$conn)
or die("could not execute query");
while( $row = mysql_fetch_array($rs) )
{
echo("ID: ".$row["id"]);
echo("<br>Strength: ".$row["strength"]."<br>");
}
?>
</body></html>