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 6 of 6
  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

    Banner Rotator Display Issue

    SOLVEDThis is the code for banner on home page.. Its in random order now, can some one provide me with solutions to change it from being random? Please help me.

    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 Inigoesdr; 09-10-2011 at 09:28 PM.

  • #2
    iAm
    iAm is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I know if I remove the
    PHP Code:
    order by Rand () 
    It displays everything in the opposite order I wish it to work. If some1 can even provide a list of display commands that would help too. Thank You.

  • #3
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,555
    Thanks
    75
    Thanked 105 Times in 104 Posts
    Please don't double post. To have it ordered by a certain field you'd do this.

    PHP Code:
    $rotator=mysql_query("SELECT id,img,title,info,link FROM rotator ORDER BY id DESC"); 
    That will make it in order from ID 1 to ID 999 or whatever your last record is.

  • Users who have thanked myfayt for this post:

    iAm (09-10-2011)

  • #4
    iAm
    iAm is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts
    And I apologize for asking such a simple question, but i am still learning, and I searched all over google. Thats how I landed on this website. So, can some1 please help me? PLEASE

  • #5
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,555
    Thanks
    75
    Thanked 105 Times in 104 Posts
    I already posted what you need above.

  • Users who have thanked myfayt for this post:

    iAm (09-10-2011)

  • #6
    iAm
    iAm is offline
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts
    o wow thank you very much... I wont double post again. Thank You, thank you, this means the world to me


  •  

    Posting Permissions

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