Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
Niko
- Forum Newbie
- Posts: 9
- Joined: Tue Apr 20, 2004 6:17 am
Post
by Niko »
Im after displaying multiple rows in PHP with a mysql database, and inserting them into a menu system.
the problem is that it repeats the first row n number of times,
Code: Select all
$menuTitle = ($row_rsHome['pageTitle']);
$menuURL = ($row_rsHome['pageURL']);
do {
SSAddMenuItem ("$menuTitle","$menuURL", "",$home);
} while ($row_rsHome = mysql_fetch_assoc($rsHome));
[Edited because:
viewtopic.php?t=21171 --JAM]
-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA
Post
by magicrobotmonkey »
Code: Select all
<?php
while ($row_rsHome = mysql_fetch_assoc($rsHome)){
$menuTitle = ($row_rsHome['pageTitle']);
$menuURL = ($row_rsHome['pageURL']);
SSAddMenuItem ("$menuTitle","$menuURL", "",$home);
}
?>
Give that a try... You were setting title and url only once, outside of the loop!