February 3rd, 2005, 08:13 AM
simple while loop prob driving me mad!
Hi i wish to simply display the results of a column.. i use....
$query = "SELECT * FROM leagues WHERE leagueid = 1";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
$leaguename = $row['leaguename'];
$leagueid = $row['leagueid'];
echo ($leaguename); is only showing the first result, why is it not showing the rest?!
February 3rd, 2005, 08:16 AM
this has got to be the most stupid question i ever asked! its my select statement causing the prob "where leagueid = 1"
what an idiot, i need to take a break!
Comments on this post
February 3rd, 2005, 08:17 AM
hmmmmm, there doesn't appear to be anything obviosuly wrong...
i have to ask the question... there is more than one result in the db... yeah??
how about trying to extract and print the data in a different way
not sure why this would make a difference but it might be worth trying if you are sure there are more results to be printed !!!
while($row = mysql_fetch_object($result))
$leaguename = $row->leaguename;
$leagueid = $row->leagueid;
let us know how you get on
February 3rd, 2005, 08:19 AM
lol, glad you got it working!!!!
Originally Posted by nshack31