SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    Brasil
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help on numbering the pages of a query result!

    I would like a little help here in what is wrong with my sintax? I need to print the number of pages of a query result linked to the respective results take a look:
    PHP Code:
    if(!isset($comeco)){
        
    $comeco "0"
    }
    $inscritos mysql_query(SELECT COUNT(Alunos_IDFROM Curso_Potensal_Alunos) ;
    $paginas "$inscritos/30"I need to round this number UP 
    while($paginas >= $pagnumero){
        
    pagnumero++;
        if(
    $comeco == "0"){
        echo(
    "<font face=verdana color=black size=2><a href=\"" $PHP_SELF "?comeco=" . ($pagnumero*$comeco)> $pagnumero </a></font>");
        }
        else{
        echo("
    <font face=verdana color=black size=2><a href=\"" $PHP_SELF "?comeco=" . (($pagnumero*30)-1)> $pagnumero </a></font>");
        }
    }
    $sql = "SELECT Alunos_IDAlunos_NomeAlunos_EmailAlunos_InstituicaoAlunos_Registro FROM Curso_Potensal_Alunos LIMIT" . $comeco . ",30";
    $info = mysql_query($sql);
    while(
    $infor = mysql_fetch_array($info)){
                            
    $id = $infor["Alunos_ID"];
                            
    $aluno = $infor["Alunos_Nome"];
                            
    $email = $infor["Alunos_Email"];
                            
    $instituicao = $infor["Alunos_Instituicao"];
                            
    $registro_academico = $infor["Alunos_Registro"];
                            echo("
    <font face=verdana size=1 color=black>$aluno</font>\n");
                            echo("
    <font face=verdana size=1 color=black>$email</font>\n");
                            echo("
    <font face=verdana size=1 color=black>$instituicao</font>\n");
                            echo("
    <font face=verdana size=1 color=black>$registro_academico</font>\n");
                            echo("
    <font face=verdana size=1 color=black><a href='aluno_mais.php?id=$id'>+ info</a></font>\n");
                        } 
    That's it i would be thanfull if someone could help me finishing this.
    ***: Joao Gabriel Branco

  2. #2
    SitePoint Enthusiast jpp's Avatar
    Join Date
    Nov 2003
    Location
    Arnhem, The Netherlands
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The next line does not look ok:
    PHP Code:
    echo("<font face=verdana color=black size=2><a href=\"" $PHP_SELF "?comeco=" . ($pagnumero*$comeco)> $pagnumero </a></font>"); 
    Try:
    PHP Code:
    $temp $pagnumero*$comeco;
    echo(
    "<font face=verdana color=black size=2><a href=\"".$PHP_SELF."?comeco=".$temp.">$pagnumero</a></font>"); 
    JPP


Bookmarks

Posting Permissions

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