SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Basic PHP Question

    Hello,

    I'm trying to create an extremely basic PHP script. Here's how it would work. Somebody visits a page. The script then connects to the database and table, and then looks for a row that has the specific ID, and then looks at the TiemsViewed column and adds one two it. (meaning that if it was 5, it changes it to 6.) How do I do this? Any help is greatly appreciated.
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  2. #2
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    mysql_connect
    ("localhost"$user$pass);
    mysql_select_db($db);
    $result mysql_query("select TimesViewed from table where ID='$ID'"); $tv=mysql_result($result); $tv++;
    $result mysql_query("update table set TimesViewed='$tv' where ID='$ID'");
    ?>

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2000
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oliver,

    Thank you very much!!
    Corbb O'Connor
    Looking for quality website design or database programming?
    Contact me for more information and a FREE quote!

  4. #4
    :) delemtri's Avatar
    Join Date
    Jun 2001
    Posts
    579
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure.


Bookmarks

Posting Permissions

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