View Full Version : How to Change from Random in Banner Rotator

09-10-2011, 06:10 PM
SOLVEDHi I'm new to php, I have been learning for a couple of months.. I have a script for a news / image rotator.. It works fine, but my only problem is that it shows everything in random order... I tried adding the desc command, but I get an error message... so, can some1 tell what to change so that I can show by highest ID first? I will appreciate all the help I can get... Thanks.

$timeoutseconds = 300;
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;

$rotator=mysql_query("SELECT id,img,title,info,link FROM rotator ORDER BY RAND() LIMIT 0,4");
$max_length = 70;
if (strlen($title) > $max_length){
$title = substr($title,0,$max_length);
$title .= "..."; }

09-10-2011, 06:59 PM
I'm curious to know how you are displaying the "news article",
within a <div>, or and <iframe>? I assume it has to change
smoothly with no page refresh?

And is the 'img' column in your MySQL table a URL (link) to an image
in a directory, or have you stored your images within MySQL (BLOB)?


09-10-2011, 07:22 PM
yes it changes smoothly with no refresh, within <div> ... and its inside a directory..

But some1 answered the question here http://www.codingforums.com/showthread.php?t=237606sorry for the double post, but thanks for the help. Im loving this site... I will try to be helpful as I learn more, so, see every1 around.. :)