Hello,
This is driving me crazy, as I cannot get it working.
I have a database that has a table called 'categories'. I need to retrieve all categories with category_id != '1,2,3'. For this, I can this query:
$q = "SELECT * FROM categories WHERE category_id NOT IN (1,2,3
)";
The query executes fine. I need this categories retrieved, to be passed to a Smarty Template Engine powered page. I have:
$q = "SELECT * FROM categories WHERE category_id NOT IN (1,2,3)";
$res = mysql_query($q);
while($row=mysql_fetch_array($res)) {
Assign('categories',$row);
}
But when retrieving the array in the Smarty page, with a loop, I only see the last item of the array (the last category).
If I go back to the while loop, and add a
print_r($row);
, I see two arrays (I have two categories).
But the question is: How can I work with those two categories, as I need to use them individually outside the while loop?
Any help is appreciated.
Best Regards,
Richi