[PHP] Re: paging
Take a look at http://www.tonymarston.net/php-mysql/pagination.html -- Tony Marston http://www.tonymarston.net http://www.radicore.org Jim Douglas jd...@hotmail.com wrote in message news:col119-w57b0a24af94fce04673622bb...@phx.gbl... Does anyone have a link to any examples of paging? I have this example up and running, http://www.w3schools.com/php/php_ajax_database.asp I have paging working as below, my problem is when I add a CSS style sheet I now have 4 panes. How can I direct the paging results to the content pane? ?php $q=$_GET[q]; $start=$_GET[start]; $con = mysql_connect('localhost', 'root', 'mypassword'); if (!$con) {die('Could not connect: ' . mysql_error());} mysql_select_db(bar, $con); $page_name=getbars.php; if(!isset($start)) {$start = 0;} $sql2=select * from bars WHERE geog_id = '.$q.'; $result2=mysql_query($sql2); echo mysql_error(); $nume=mysql_num_rows($result2); $eu = ($start - 0); $limit = 10; $this1 = $eu + $limit; $back = $eu - $limit; $next = $eu + $limit; $sql=select * from bars WHERE geog_id = '.$q.' limit $eu, $limit; $result = mysql_query($sql); echo table border='0'; while($row = mysql_fetch_array($result)) { if($bgcolor=='#f1f1f1'){$bgcolor='#ff';} else{$bgcolor='#f1f1f1';} echo tr ; //echo td align=left bgcolor=$bgcolor id='title'nbsp;font face='Verdana' size='2'A HREF= . $row['bar_website'] .. $row['bar_name'] . /A/div/font/td; echo div id='lbBarList' /div; echo td align=left bgcolor=$bgcolor id='title'nbsp;font face='Verdana' size='2'A HREF= . $row['bar_website'] .. $row['bar_name'] . /A/div/font/td/div; echo /tr; } echo /table; if($nume $limit ){ // Let us display bottom links if sufficient records are there for paging /// Start the bottom links with Prev and next link with page numbers / echo table align = 'center' width='50%'trtd align='left' width='30%'; if our variable $back is equal to 0 or more then only we will display the link to move back if($back =0) { print a href='$page_name?start=$back'font face='Verdana' size='2'PREV/font/a; } } echo /tdtd align=center width='30%'; $i=0; $l=1; for($i=0;$i $nume;$i=$i+$limit){ if($i $eu){ //echo a href='$page_name?start=$i'font face='Verdana' size='2'$l/font/a ; echo a href='$page_name?start=$i'font face='Verdana' size='2'$l/font/a ; } else { echo font face='Verdana' size='4' color=red$l/font;} $l=$l+1; } mysql_close($con); _ Windows LiveĀ: Keep your life in sync. http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_022009 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: paging
... Are you the same Tony Marston who was on the Demon Internet webmaster type mailing list? (I don't remember the actual name). -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: paging
Richard Heyes rich...@php.net wrote in message news:af8726440902101100r4d479ddds189b617f06b88...@mail.gmail.com... ... Are you the same Tony Marston who was on the Demon Internet webmaster type mailing list? (I don't remember the actual name). I doubt it. I don't subscribe to any list with either demon or webmaster in its name, although Demon Internet is my ISP. -- Tony Marston http://www.tonymarston.net http://www.radicore.org -- Richard Heyes HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari: http://www.rgraph.org (Updated January 31st) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Paging / Navigation Help
I'd appreciate it if you didn't email me personally for PHP related issues. That's what the php list is for. I would guess that most other people on the list feel the same way. Take care, Nik -Original Message- From: William Martell [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 12, 2002 11:56 AM To: phplist; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Paging / Navigation Help Hello ALL. Can anyone tell me why the number of rows is always 1 and count is the total number of records in my database. Thanks in Advance, William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Paging through MySQL results in PHP
hi nelson, i'm not sure if i get you right, but you could store the 'base' of your generated SQL query in a session variable, that way you don't have to drag the $kw array along. // before any html output (sends http headers) session_start(); // build query from keywords -- results in string $s_base_query session_register(s_base_query); then, for every new page you build your full query like this: $query = $s_base_query . LIMIT $firstitem,$items; hope this helps, phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]