Page 1 of 1

Mulitiple Database rows,

Posted: Tue Apr 20, 2004 6:17 am
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]

Posted: Tue Apr 20, 2004 6:53 am
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!