Try this :

Paginator - a class that can help you to split MySQL database query result sets to 
pages.
http://www.weberdev.com/get_example.php3?count=3707

Sincerely
 
berber
 
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com
Search for PHP Code from your browser http://toolbar.weberdev.com


-----Original Message-----
From: Ted Conn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 11:01 PM
To: [EMAIL PROTECTED]
Subject: [PHP] google style paginating


Hi I am new to this newsgroup and I plan on replying to all the posts I can for now... 
but Id like to start out by asking a question. I am trying to paginate my sql results 
in 10 by 10, which I have been able to do no problem. but what I want to do is have 
the pages layed out in google style with (1)(2)(3)(4) etc etc and each one is 
clickeable that will take you to that page. I'll show you the code I am using now for 
next and back buttons...



//located at top of page
<?php
include("include/conex.php");
$link=Conectarse();
?>

//start of body, this verifies that so is numeric, divisible by 10, and a valid number 
<?php $q="SELECT id FROM tblNoticias ORDER BY id "; $result=MYSQL_QUERY("$q",$link); 
$num_rows=(MYSQL_NUM_ROWS($result));
if ( isset($_GET['so']) && is_numeric($_GET['so']) )
{
 if ( ($_GET['so'] > $num_rows) || ($_GET['so'] < 0) )
  $so='0';
 else
 {
  if ($_GET['so'] % 10)
   $so='0';
  else
   $so=$_GET['so'];
 }
}
else
 $so='0';
?>

//return results

<?php
$q="SELECT id,titulo,texto,img1_data FROM tblNoticias ORDER BY id DESC LIMIT $so,10";
    $result=(MYSQL_QUERY("$q",$link));
    while ($row=(MYSQL_FETCH_ARRAY($result))){
?>

// next and back buttons

                        <?PHP

  if ( $so >=10)
  {
  $sortback= $so-10;
  echo "<A HREF=\"noticias_historia.php?so=$sortback\" class=\"mainText\"><< 
Atras</A>" ;
  }
  ?>
                        <?PHP

 $sortforth=$so + 10;
  $existencias=MYSQL_QUERY("SELECT id FROM tblNoticias LIMIT $sortforth,10",$link);
  $existencias=MYSQL_NUM_ROWS($existencias);
  if ( $existencias > 0 )
  echo " <A HREF =\"noticias_historia.php?so=$sortforth\"
class=\"mainText\"> Siguiente >> </A>";
   ?>


DID I PUT WAY TO MUCH CODE?? Sorry, and I apreciate your help.

How can I implement the google style paging into this code?

Thank you...




Ted Conn Lider de Proyectos [EMAIL PROTECTED] Scinet México S.A. de C.V.
+52 (222) 294-05-95 al 97 Sin costo: 01-8000-DOTCOM Puebla · DF · 
+Monterrey
www.scinet.com.mx



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to