I have a problem with counting all rows. My query is:
SELECT info.pid, Name, Addr, Phone, GROUP_CONCAT(URL) as URL
FROM info, images WHERE info.pid = images.pid AND place='$kraj' GROUP BY info.pid
I cant use mysql_num_rows
since group_concat()
creates a row (null values) even though there are no results.
I tried putting COUNT()
inside query:
...GROUP_CONCAT(URL) as URL, COUNT(info.pid) as num FROM info...
but it counts separate rows for every join.
Any suggestions?
Why not just filter out the null values? :
SELECT info.pid, Name, Addr, Phone, GROUP_CONCAT(URL) as URL
FROM info
JOIN images
ON info.pid = images.pid
WHERE place = ...
AND URL IS NOT NULL
GROUP
BY info.pid
;