Results 1 to 5 of 5

Thread: Photo Gallery

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139

    Photo Gallery

    I have photo gallery with my mysql database. My page finds phots going by a category id in the sql table and displays a list of correct photos.

    One feature I want to add to this is

    1/ when a person clicks on a photo for a full size it adds it to a hit counter to later I can sort by best photo as well.

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Cool.

    So, uh...what's your question?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2003
    Location
    Auckland
    Posts
    1,139
    Originally posted by The Hobo
    Cool.

    So, uh...what's your question?
    What line of clode will I need to add to my showpicture.php?id=22

    so that every time it's loaded it adds one to the photo counter....

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    Make a new field called 'count' as an integer in your MySQL table and add this function somewhere in your code.. Call it whenever the showpic.php is called with the ID of the picture passed in the parameters. If you're using $_GET['id'] like in your example of 'showpic.php?id=22' then call it like "updateCount($_GET['id']);'.

    PHP Code:
    function updateCount($id){
      
    $qry mysql_query("UPDATE table SET count=count+1 WHERE id='$id' LIMIT 1");

    see how that works for you.. tweaking will probably be needed, too.
    Like Archer? Check out some Sterling Archer quotes.

  5. #5
    Addicted Member
    Join Date
    Sep 2002
    Location
    Durham, NC, US
    Posts
    218
    If you are using Gallery and not something you wrote yourself, then I think you will find more appropriate help at the Gallery Forum.
    Travis, Kung Foo Journeyman

    Web Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.5 Guide and Reference
    Perl: Documentation, Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    OSS: Mozilla, MySQL (Manual)

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