I have some image file names stored in my database table with a category_id for each image.
I have the gallery all on one page and query each image by the category_id.
Example:
[ul][li]Gallery 1 = images with value of category_id 1[/li]
[li]Gallery 2 = images with value of category_id 2[/li]
[li]Gallery 3 = images with value of category_id 3[/li][/ul]
So my question is, if my category_id’s value is 3 then I want it to show the image(s).
If the category_id is not 3 as there is no images with the category_id value of 3, I want to display a message saying, “no content”, or whatever.
Here is the part of my code I’m trying to figure out. Hoping someone can give me a hand.
[php]$images = DB::getInstance()->query("SELECT category_id
FROM images
WHERE category_id = 3 ");
$category_id = (int)[“category_id”] == 3 ?true:false;
if($category_id == (int)3){ ?>
Content
if(!$category_id == (int)3 ){ ?>