Update Aint Workin

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Update Aint Workin

Post by Dale »

Right i am making a forum package... and i wanna know why this aint working for...

viewthread.php

Code: Select all

$result = "UPDATE df_threads SET views=views+1 WHERE id = '$threadid'";
My database info is included in another file thats included to that file.. (confusing.. anyway). The table is called df_threads and i want the col views to go up 1 number when people access that page.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Do :
echo $result;
mysql_query($result) or die(mysql_error());

If you don;t see the $result echo line, then it's not even getting that far, otherwise you should see the mysql_error() output which will tell you what's wrong.
Dale
Forum Contributor
Posts: 466
Joined: Fri Jun 21, 2002 5:57 pm
Location: Atherstone, Warks

Post by Dale »

Yes it worked!!!! Thank markl999!
Post Reply