just split up your total number of results ($num_rows) by the results per page (10, i think) and create a for loop to loop from page1 to pagex, creating a link with offset for each one.
simple. "Ted Conn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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