![]() |
MySQL Query to Count Photos in Photo Gallery and Update Forum DB
Our forum has a photo gallery (Photopost PHP) and on our user profiles, and on the postbit pages, it shows a link to the users gallery IF they have photos in it. There at one point WAS a script in our maintenance scripts that automatically ran to update this count (it was called update_photo_count.php - but it's nowhere to be seen on the drive, and probably hasn't been run since we moved ISP's 4 months ago). We have added a field to our user table in the FORUM DB called "photos"
Let's call the photo gallery DB "Gallery" and the vB DB "Forum" If I run this query on the GALLERY DB Quote:
Thanks :) |
Not tested and I am not sure about your query but you can start with something like this:
PHP Code:
Code:
$total_photos[count] |
Mostly what I'm looking for is something we can run as a scheduled task. Querying the DB like that for every thread view is time consuming. We had a script, but can't seem to locate it.
We have a field in our FORUM DB called "photos". I want to UPDATE user Set photos = count (photos from gallery DB) but I'm not sure how to do that where I query the Gallery DB and insert the results into the FORUM DB. Does that make more sense? EDIT - 9/16/07 (automatically edited by vB.org) Ok... I figured it out... Here it is. PHP Code:
To add this to user profile info, or on the postbit legacy - insert this Code:
<if condition="$post['photos']"><div>Photos: (<a href="/gallery/showgallery.php?cat=500&ppuser=$post[userid]">$post[photos]</a>) <a href="/gallery/showgallery.php?cat=500&ppuser=$post[userid]">View Gallery</a></div></if> |
All times are GMT. The time now is 07:57 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|