A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: help

  1. #1
    Senior Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    159

    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

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    change the update to
    UPDATE forum SET total = total+1
    No dollar signs, no WHERE clause...

    Musicman

  3. #3
    Senior Member
    Join Date
    Mar 2008
    Location
    England
    Posts
    159

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center