Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Debug PHP/MySQL Probable Simple Mistake...

    can someone tell me what's wrong with this script...i copied it rite off phpfreaks.com and it don't work...i'm sure it's because my table has different names...but here take a look
    <?php
    $link = mysql_connect("localhost", "???", "???")
    mysql_select_db("AnthonySQL")
    mysql_query("UPDATE webhits SET index=(count + 1)");
    mysql_close($link);
    ?>
    The table is named webhits
    and we're trying to make 'index' increase by 1
    ...anyone c the problem? I think error says its this line
    mysql_query("UPDATE webhits SET index=(count + 1)");
    Not positive tho..

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    a quick guess wuld be ...

    mysql_query("UPDATE webhits SET index=(index + 1)");
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Okay Thanks I hAve no Errors now...but now the script itself doesn't work...any suggestions?

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    is 'index' an integer type field ? (if not make it so) , also do you have several records & a primary key , e.g. do you need to add a WHERE id=$id to your query ?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •