Jump to content

i don't have the links for next/prev page


ionnnnutz

Recommended Posts

can somebody take a look at this code and help me see where is the problem? i get all the data but the links to next/prev page doesn't appear.


<?php
require ('includes/connect.php');



    $limit          = 5;
    $query_count    = "SELECT count(*) FROM comp, comp_pnote  WHERE comp.comp_id = comp_pnote.comp_notesid and comp.comp_id ='".$ID."'";
    $result_count   = mysql_query($query_count);
    $totalrows      = mysql_num_rows($result_count);

    if(empty($page)){
        $page = 1;
    }


    $limitvalue = $page * $limit - ($limit);
    $query  =("SELECT comp.comp_nume,date_format(comp_pnote.comp_note_entry_date, '%W') as entry_date,date_format(comp_pnote.comp_note_entry_date, '%d.%m.%Y') as entry_date2,date_format(comp_pnote.comp_note_entry_date, '%H:%i') as entry_date3,comp_pnote.comp_note_message from comp, comp_pnote  WHERE comp.comp_id = comp_pnote.comp_notesid and comp.comp_id ='".$ID."' ORDER BY entry_date2 DESC LIMIT $limitvalue, $limit");
    $result = mysql_query($query) or die("Error: " . mysql_error());








    if(mysql_num_rows($result) == 0){
        echo("Nothing to Display!");
    }

    $bgcolor = "#E0E0E0"; // light gray

    echo("<table>");

    while($row = mysql_fetch_array($result)){


    $entry_date = $row["entry_date"];
    $message = $row["comp_note_message"];
    $entry_date2 = $row["entry_date2"];
    $entry_date3 = $row["entry_date3"];


        if ($bgcolor == "#E0E0E0"){
            $bgcolor = "#FFFFFF";
        }else{
            $bgcolor = "#E0E0E0";
        }

    echo("<tr bgcolor=".$bgcolor.">n<td>");
    echo($entry_date);
    echo("</td>n<td>");
    echo($message);
    echo("</td>n</tr>");
    }

    echo("</table>");

    if($page != 1){
        $pageprev = $page--;

        echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV".$limit."</a> ");
    }else{
        echo("PREV".$limit." ");
    }

    $numofpages = $totalrows / $limit;

    for($i = 1; $i <= $numofpages; $i++){
        if($i == $page){
            echo($i." ");
        }else{
            echo("<a href=\"$testnoteinpagina.php?ID='$id'?page=$i\">$i</a> ");
        }
    }


    if(($totalrows % $limit) != 0){
        if($i == $page){
            echo($i." ");
        }else{
            echo("<a href='$PHP_SELF?page=$i'>$i</a> ");
        }
    }

    if(($totalrows - ($limit * $page)) > 0){
        $pagenext = $page++;

        echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>");
    }else{
        echo("NEXT".$limit);
    }

    mysql_free_result($result);

Link to comment
https://forums.phpfreaks.com/topic/48253-i-dont-have-the-links-for-nextprev-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.