Joshua F Posted May 6, 2010 Share Posted May 6, 2010 How would I make the following code be able to be used more then once, so I can make it post more then just sitename? $result = mysql_query("SELECT sitename FROM sitelist WHERE id=". $_SESSION['id']) or die(mysql_error()); list($sitename) = mysql_fetch_row($result); Example: I have it so when the user is logged in, and they go to the UserCP, they can see there Site Name, but I can't make it say more then Site Name without getting an error. Link to comment https://forums.phpfreaks.com/topic/200951-how-would-i/ Share on other sites More sharing options...
JAY6390 Posted May 6, 2010 Share Posted May 6, 2010 $result = mysql_query("SELECT sitename FROM sitelist WHERE id=". $_SESSION['id']) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { $sitename[] = $row['sitename']; } Each of the site names will then be in an array in the $sitename variable Link to comment https://forums.phpfreaks.com/topic/200951-how-would-i/#findComment-1054367 Share on other sites More sharing options...
Joshua F Posted May 6, 2010 Author Share Posted May 6, 2010 Thsnks, but I figured it out befor you posted. But Thanks anyways =] Link to comment https://forums.phpfreaks.com/topic/200951-how-would-i/#findComment-1054373 Share on other sites More sharing options...
JAY6390 Posted May 6, 2010 Share Posted May 6, 2010 hehe no problem Link to comment https://forums.phpfreaks.com/topic/200951-how-would-i/#findComment-1054374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.