hello all -
I am using mysql and php to generate a navigation bar for a site I'm working on. I set up the table with the following fields -
id tinyint(2) auto-increment primary
position tinyint(2) unique - this determines the position of a link in the navbar
display tinyint(1) - this is to determine if a link is displayed in the navbar or not
the php that generates the navbar looks like this -
// Until there are no rows in the result set,
// fetch a row into the $row array and
while ($row = @ mysql_fetch_row($result))
for($x=1; $x<9; $x++)
echo $link->horizLink . " | ";
$query = "SELECT * FROM topNav WHERE display=1 ORDER BY position";
// Connect to the MySQL server
if (!(mysql_select_db("rbos", $connect)))
// Run the query on the connection
if (!($result = @ mysql_query ($query, $connect)))
// Display the results
and for some reason it wont show the first row, so my navbar is missing the first link - "introduction" in this case.
things I've done so far -
-when I changed the id of the introduction row from 1 to 11,
same result, the second item, "about" appears first but no "introduction".
-when I deleted the "introduction" row from the topNav table, the original second item, "about", was missing and the third menu item appeared first.
-I replaced the introduction row and changed the position numbers of each of the menu items so that the list of items started at 2 instead of 1. So at this point, the introduction row is id 15 (because it went to the end of the list when I replaced it) and position 2 (so it would appear first in the nav bar.) The results were the same as when it was position 1 - no introduction link in the nav bar.
- when I removed the ORDER BY from the select statement, "introduction" appeared as the last item in the navigation but the second item, "about" was missing with the third menu item appearing first.
It seems like something simple, but I'm not getting it.
I'm hoping that someone out there is wiser than me and they will be kind enough to explain what I have over looked.
thanks in advance