On Wednesday 05 February 2003 12:50, Le Hoang wrote:
>
> // Add 1 view to the view column
>
> $v = $row[view];
> $vplus = $v+1;
> $view = mysql_query("update photoshop_tutorial where id=$id set
> view=$vplus"); // Problem here!
You should ALWAYS check the result of a call to mysql_query():
if ($view === false) { echo "Fatal error: " . mysql_error(); }
Your problem is that the SQL for update is incorrect and it should be:
"UPDATE photoshop_tutorial SET view = $vplus WHERE id = $id"
You can also do the increment inside the SQL so:
"UPDATE photoshop_tutorial SET view = view + 1 WHERE id = $id"
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Tell a man there are 300 billion stars in the universe and he'll believe you.
Tell him a bench has wet paint on it and he'll have to touch to be sure.
*/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php