I've been having a terrible time with this update code for MySQL. I've searched all over the internet, looked up examples, and it still doesn't help me. The problem I'm having is that my variable $count does not get updated in the database query.
$id=$_GET['id'];
mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM links";
$result=mysql_query($query);
$count=mysql_result($result,($id),"count");
$count++;
$query = "UPDATE links SET count='$count' WHERE id = $id";
mysql_query($query);
echo mysql_error();
mysql_close();
Any help would be greatly appreciated as I'm quite new to PHP and MySQL.
?>[/php_man]
$db = mysql_connect('localhost',$user,$password) or die(mysql_error());
mysql_select_db($database) or die('Unable to select database');
$query = "UPDATE links SET count=count+1 WHERE id = {$_GET['id']}";
mysql_query($query) or die(mysql_error());
mysql_close($db);