For the query i need to do, a user uploads videos onto an album, on their video page, it has the list of albums, and the total of videos below it.
Currently, what i am trying to do is a union, however this is not working, this is my code:
$query="SELECT albname, albcover, lid, NULL as vidcount FROM albums WHERE USERID='".mysql_real_escape_string($USERID)."' and verified='1'
UNION
SELECT NULL as albname, NULL as albcover, NULL as lid, count(*) as vidcount FROM albs_vids A LEFT JOIN albums B USING(ALBID) WHERE B.USERID='".mysql_real_escape_string($UID)."'";
So, what happens is the SQL query needs to find the data of the album, ie albname, albcover and lid from the table albums. Then find the amount of videos in the table albs_vids which correspond to the album. The album is specified by ALBID in both tables.
Hard to completely understand what you’re asking ,but this will give you the count of videos for each album that has your userid: