I have a simple script, but it has just got a little more complex, at least for me.
so here it is, I need to request 2 menu buttons from table which contains all of them together. ID for both is known as it is already rendered by another script on the same page and wrapped in variables $cat_main_id
and $cat_add_id
. So here is my script, well at least a top part of it and my question is how I can get both menu buttons to be obtained by the same query, if that is actually possible?
if ($cat_main_id > 0) {
$menu_query = 'SELECT * FROM lcategories WHERE ID in ( :id , :id2 )';
$res = $db->prepare($menu_query);
$res->execute(array(':id' => $cat_main_id, ':id2' => $cat_add_id));
foreach ($res as $info);
} else {
echo '';
}
while ($info = $res -> fetch()){
$category_name = str_replace("&", "&", $info['category_name']);
$category_page = $info['category_page'];
$category_dir = $info['category_folder'];
$category_link = DS.$category_dir.DS.$category_page;
print<<<END
<div class="post_cat">Posted in category <a href="$category_link" class="cat">$category_name</a> <a href="$category_link" class="cat">$category_name</a></div>
<div class="clear"></div>
END;
}