RE: [PHP-DB] Limited number of database results
by Bastien Koert other posts by this author
Dec 13 2006 9:08AM messages near this date
Re: [PHP-DB] Limited number of database results
|
[PHP-DB] multiple database join with pdo
use the limit clause
$count = 25;
$query="SELECT * FROM xxxx WHERE hello = '$hello' limit $count";
Bastien
> From: Chris Carter <chandan9sharma@[...].com>
> To: php-db@[...].net
> Subject: [PHP-DB] Limited number of database results
> Date: Wed, 13 Dec 2006 08:51:47 -0800 (PST)
>
>
> Hi,
>
> I have more than 200 rows of data to show to the user. How can I limit it
> to
> say 25 rows per page and give an option at the bottom to the user to keep
> clicking for more till s/he reaches the end of data.
>
> my db code is:
>
> </tr>
> </thead>
>
> <tbody>
>
>
> <?php
>
> // database information
> $host = 'localhost';
> $user = 'xxxx';
> $password = 'xxxx';
> $dbName = 'xxxx';
> $hello = $_REQUEST['hello'];
>
> mysql_connect(localhost,$user,$password);
> @mysql_select_db($dbName ) or die( "Sorry But There Seems To Be A Problem
> Connecting To The Database");
>
> $query="SELECT * FROM xxxx WHERE hello = '$hello'";
> $result=mysql_query($query);
>
> $num=mysql_numrows($result);
>
> mysql_close();
>
> $i=0;
> while ($i < $num) {
>
> $showThis=mysql_result($result,$i,"showThis");
>
>
> echo "
> <tr>
> <td>$showThis</td>
>
> </tr>";
>
> $i++;
> }
>
> if (num==0)
> {
> <tr><td>Sorry no results displayed</td></tr>
> }
> ?>
>
> </tbody></table></div>
>
> Seems like I am the only one asking questions since past few days. Thanks
> anyway for your support. I am just about to launch my site. Just after I
> achieve this. It will be very userfriendly.
>
> Thanks in advance.
>
> Chris
> --
> View this message in context:
> http://www.nabble.com/Limited-number-of-database-results-tf2815179.html#a7856535
> Sent from the Php - Database mailing list archive at Nabble.com.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
Download now! Visit http://www.telusmobility.com/msnxbox/ to enter and see
how cool it is to get Messenger with you on your cell phone.
http://www.telusmobility.com/msnxbox/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Chris Carter
Niel Archer
John Meyer
Bastien Koert
|