pulling results from db using php, rotating using javascript

Discussion in 'JavaScript' started by AussieFreelancer, Dec 5, 2006.

  1. #1
    Hi everyone,

    I am a PHP programmer, and I am currently developing a website whereby the client has asked that the results are rotated.

    Each day, results of games are stored in the MySQL database, and there will be a varying number of games for the day. One day there might be 2, another there might be 10.

    I would like to provide a solution where the website will display a specified number of results, and then 5 seconds later, automatically display the next lot, and so on. This should be on a continuous loop, so that when the last result is reached, the process repeats.

    I don't know much about javascript, so was wondering if someone could help me build this? So far, I have the following:

    <script>
    
    var limit = 4;
    
    var from = 0;
    var to = from + limit;
    
    function rotate_scores(s)
    {
    	window.setTimeout('change_scores()', s*1000)
    }
    
    function change_scores()
    {
    	
    }
    
    </script>
    Code (markup):
    but i don't know where to go from here. not sure on the syntax of how to get the results from the db, into something that javascript can use.

    any help would be really appreciated

    Many thanks

    Patrick
     
    AussieFreelancer, Dec 5, 2006 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    The explanation is rather large, I'll be happy to help you on msn ....
     
    krakjoe, Dec 6, 2006 IP
  3. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #3
    mad4, Dec 6, 2006 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    That is cool, I never seen that before ....
     
    krakjoe, Dec 6, 2006 IP