-
help
Hi
I am using PHP and mysql and what i want to happen is that when you click submit the database will be +1. So if the database (it is called forum and the line is called total) = 1 then when you click on the button the db = 2.
Here is the code so far:
if(isset($_POST['message'])){
$total = 'mysql_query("SELECT total FROM forum")';
mysql_query("UPDATE forum SET total = '$total+1' WHERE total = '$total' ");
}
echo "<input type=\"text\" name=\"message\">";
For some reason the db just says 1 no matter how may times i add a message on to the forum it just says 1.
What should i do??
Thanks
Thanks
Rhys
-
Hi,
change the update to
UPDATE forum SET total = total+1
No dollar signs, no WHERE clause...
Musicman
-
Thanks!
Thanks it works!!
Thanks
Thanks
Rhys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|