Here's what I'm trying to do:
Select a category's name and id from the table "categories" where section is "Articles" and published is "1", order by categoryid. Once I get the query result set, I need to reassign the categoryid for each row so that the first row is given id of '1', the next row is given id of '2', etc.. The reason for reassigning the id is that i only want the categories under the articles section. The first category in the articles section might have an overall category id of '4', even though it is the first category for the articles section. I'm using this to build my navigation menus.
Here's the code i've got so far. What do I need to get this to work?
$query="select categoryid, categoryname from categories where section='Articles' and published='1' order by categoryid";
$name=$categoryname
$topicid=/ this is where i'm stuck on how to reassign categoryid starting from 1 /
$result=$database->openConnectionWithReturn($query);
echo "<a href='$link&Itemid=3&topid=$topicid'>$name</a>";
Thanks!