paging problem

Discussion in 'PHP' started by thegetpr, Jan 5, 2009.

  1. #1
    i have been trying to make this work so i come here asking for help...

    i managed to make a so called paging , the script gathers data from a mysql database and displays them on the page and makes paging the links ( page: 1 2 3 and so on ).

    what i have been trying to do this whole day is that when page 2, for example, is clicked, the color would change .

    to be more specific here is the code:

    //gathering the requierd data from the database
    
    $count = mysql_query("SELECT COUNT(*) FROM games WHERE             game_type=$gt");
    $nog = mysql_fetch_row($count);
    $x=$nog[0]/16;
    
    //starting a div and a table
    
    echo "<div id='page' align='center'>";
    echo "<table border='1' class='nr' >";        
    echo "<td class='nrp'>Page:&nbsp;&nbsp;</td>";
    
    //the links generator
    
    $n=1;
    for ($i=1; $i<= ceil($x); $i++) {
    if ($i > 1) $n=$n+16;
    
    echo "<td id='navigationDiv' width='10px' height='10px'><a onclick='highlightLinks(this)' class='' href='showallt.php?offset=$n&order=game_type&game_type=$gt' >";
    echo $i;
    } 
    
    echo "</a></td>";
    
    //and the rest of the code from here down wich is not important  
    PHP:
    i have tried to make a background variable for the <td> in the loop with all sorts of code, but well... my ideas did not work and i did not find much on google regarding the actual color on the links when creating pagination

    you would observe in the loop near <a there is a onclick function, that's an idea i got from google when trying to find an answer, i tryed to change the css class of the <td> and the <a> when the link was clicked, using javascript ... but it did not work because the page reloads or a new page loads so the css class goes back to the inital value.

    Any buddy can help me
     
    thegetpr, Jan 5, 2009 IP
  2. Valdor

    Valdor Well-Known Member

    Messages:
    450
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    185
    #2
    the color of what do you want changing, the page background, page text, the list of pages???
     
    Valdor, Jan 5, 2009 IP
  3. thegetpr

    thegetpr Banned

    Messages:
    99
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    just paging number, like (1 , 2, 3 )when selected 2 then i want to change the color of 2
     
    thegetpr, Jan 5, 2009 IP