|
-
Feb 20th, 2004, 07:03 PM
#1
Thread Starter
Frenzied Member
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.
-
Feb 21st, 2004, 03:07 AM
#2
Stuck in the 80s
Cool.
So, uh...what's your question?
-
Feb 21st, 2004, 12:32 PM
#3
Thread Starter
Frenzied Member
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....
-
Feb 21st, 2004, 03:48 PM
#4
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.
-
Feb 23rd, 2004, 02:13 PM
#5
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|