Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    iAm
    iAm is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    How to Change from Random in Banner Rotator

    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.


    PHP Code:
    $timeoutseconds 300;
    $timestamp time();
    $timeout $timestamp-$timeoutseconds;

    $rotator=mysql_query("SELECT id,img,title,info,link FROM rotator ORDER BY RAND() LIMIT 0,4");
    $a=0;
    while(list(
    $id,$img,$title,$info,$link)=mysql_fetch_row($rotator)){
       
    $max_length 70;
       if (
    strlen($title) > $max_length){   
          
    $title substr($title,0,$max_length);
          
    $title .= "..."; } 
    $imageid[$a]=$id;
    $imagesrc[$a]=$img;
    $imagetitle[$a]=$title;
    $imageinfo[$a]=$info;
    $imagelink[$a]=$link;
    $a++;

    Last edited by iAm; 09-10-2011 at 07:37 PM.

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,500
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    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)?



    .

  • Users who have thanked mlseim for this post:

    iAm (09-10-2011)

  • #3
    iAm
    iAm is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts
    yes it changes smoothly with no refresh, within <div> ... and its inside a directory..

    But some1 answered the question here Banner Rotator Display Issuesorry 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..


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •