web_master Posted March 16, 2008 Share Posted March 16, 2008 hi, in database I have 100 product names. how can I list randomly this names from dbase - in marquee? <?php $query_random = mysql_query("SELECT * FROM `productgroups_2` ORDER BY `productgroups_2_id` ASC"); while($request_random = mysql_fetch_array($query_random)) { ?> <marquee><?php print $request_random['product_name'];?></marquee> <?php }?> in advanced thnxs Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/ Share on other sites More sharing options...
affordit Posted March 16, 2008 Share Posted March 16, 2008 $query = "SELECT * FROM `text_content` ORDER BY RAND() LIMIT 0,1"; $results = mysql_query($query) or die(mysql_error()."<br /><br />".$query); $info = mysql_fetch_array($results); Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/#findComment-493270 Share on other sites More sharing options...
web_master Posted March 16, 2008 Author Share Posted March 16, 2008 hi, its work fine, but what happened? - The random is working perfectly, but in marquee print only 1 product until next reload. So, I want to list randomly on one reload all the products. Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/#findComment-493309 Share on other sites More sharing options...
web_master Posted March 16, 2008 Author Share Posted March 16, 2008 no help? ??? Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/#findComment-493368 Share on other sites More sharing options...
Orio Posted March 16, 2008 Share Posted March 16, 2008 <?php $query_random = mysql_query("SELECT * FROM `productgroups_2` ORDER BY RAND()"); while($request_random = mysql_fetch_array($query_random)) echo "<marquee>".$request_random['product_name']."</marquee><br />"; ?> Orio. Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/#findComment-493370 Share on other sites More sharing options...
web_master Posted March 16, 2008 Author Share Posted March 16, 2008 Orio, super, THNXS! Link to comment https://forums.phpfreaks.com/topic/96375-random-from-dbase/#findComment-493377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.