hi all,
I’ve been using the well documented ‘Gallery Category Images’ method to pull my 4 latest gallery categories and an accompanying random image. In short, it wraps the exp:gallery:entries tags with a query.
I would now like to make a variation in which only random portrait images are pulled. This means abandoning the exp:gallery:entries tags and replacing them with a second query which enables me to pull witdh & height values.
Unforunately the query isn’t behaving like I was expecting it to:
{exp:query sql="SELECT c.cat_id as cat1 FROM exp_gallery_categories as c WHERE gallery_id='1' ORDER BY cat_id DESC LIMIT 4"}
{exp:query sql="SELECT entry_id FROM exp_gallery_entries WHERE cat_id='{cat1}' ORDER BY RAND() LIMIT 1"}
{entry_id}
{/exp:query}
{/exp:query}To my surprise the above code renders 4 times the same entry_id in stead of 4 random entry_id’s each from a different category.
What am I doing wrong here?