Hi, im using this script to show the query results, basically it shows
multiple results in multiple pages, when more than one result are found it
shows the first one and on the bottom of the pages it shows the number of
pages that remains, but fot some strange reason when you click on the first
or last page to show, it shows always the same query result . Can somebody
tell my what im doing wrong??

<?php



$db = mysql_connect("localhost", "root");



mysql_select_db("qllamo",$db);



$result = mysql_query("SELECT * FROM llamadas",$db);
$pagelimit = "1";
$totalrows = mysql_num_rows($result);
$pagenums = ceil ($totalrows/$pagelimit);

if ($page==''){

$page='1';

}

// create a start value

$start = ($page-1) * $pagelimit;



// blank matches found

echo "<b>" . $totalrows . " Llamadas encontradas</b><br>\n";



// Showing Results 1 to 1

$starting_no = $start + 1;



if ($totalrows - $start < $pagelimit) {

$end_count = $totalrows;

} elseif ($totalrows - $start >= $pagelimit) {

$end_count = $start + $pagelimit;

}

if ($totalrows - $end_count > $pagelimit) {

$var2 = $pagelimit;

} elseif ($totalrows - $end_count <= $pagelimit) {

$var2 = $totalrows - $end_count;

}



$space = "&nbsp;";





printf("Id: %s<br>\n", mysql_result($result,0,"id"));



printf("Destinatario: %s<br>\n", mysql_result($result,0,"destinatario"));



printf("Fecha: %s<br>\n", mysql_result($result,0,"fecha"));



printf("Hora: %s<br>\n", mysql_result($result,0,"hora"));



printf("Apellido: %s<br>\n", mysql_result($result,0,"apellido"));



printf("Nombre: %s<br>\n", mysql_result($result,0,"nombre"));



printf("Teléfono: %s<br>\n", mysql_result($result,0,"telefono"));



printf("Mail: %s<br>\n", mysql_result($result,0,"mail"));



printf("Mensaje: %s<br>\n", mysql_result($result,0,"mensaje"));



printf("Receptor: %s<br>\n", mysql_result($result,0,"receptor"));


// previous link (make sure to change yourpage.php to the name of your page)


if ($page>1) {

echo "? <a href='index.php?page=".($page-1)."' class=main>Previous" . $space . $pagelimit . "</a>" . $space . $space . "";

}



// dynamic page number links (make sure to change yourpage.php to the name of your page)



for ($i=1; $i<=$pagenums; $i++) {

if ($i!=$page) {

echo " <a href='index.php?page=$i' class=main>$i</a>";

}

else {

echo " <b class='red'>$i</b>";

}

}





// next link (make sure to change yourpage.php to the name of your page)



if ($page<$pagenums) {

echo "" . $space . $space . $space . $space . " <a href='index.php?page=".($page+1)."' class=main>Next " . $var2 . "</a> ?";

}





?>





Thanx.
Emilio.

_________________________________________________________________
MSN Shopping upgraded for the holidays! Snappier product search... http://shopping.msn.com



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to