According to the mysql manual which has no mention of left join, it would be one of the following:
mysql_query( "SELECT c.category_id,c.category_name,photo_filename,COUNT(photo_id)
FROM gallery_category as c
WHERE user='$user'
LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id
GROUP BY c.category_id" );
or
mysql_query( "SELECT c.category_id,c.category_name,photo_filename,COUNT(photo_id)
FROM gallery_category as c
LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id
WHERE user='$user'
GROUP BY c.category_id" );
But when using this in a mysql query don't forget to make the mysql query one long line. Hope one of those examples works for ya.
cwarn23
Occupation: Genius
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
What is the name of your user table? Is there a user_id column or something similar on the gallery_photos table?
TommyBs
Junior Poster in Training
61 posts since Mar 2008
Reputation Points: 11
Solved Threads: 11