Search Engine a Problem...?
| From: | Dhaval Desai | Date: | Fri, 10 Nov 2000 22:06:51 +0000 |
| Subject: | Search Engine a Problem...? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24727@lists.php.net to get a copy of this message | ||
Hey Guys
I have a really silly doubt. I wanted to know how the
following code works with limiting the mysql query
with the limit statement.
I have the following code here:
<?php
$host= "localhost";
$mainuser= "";
$db="";
#To use with LIMIT statement of Select
$numrecs=30;
### to check whether its the first page (page1)
if (empty($offset))
{
$offset=0;
}
if (empty($lower))
{
$lower=1;
}
if (empty($upper))
{
$upper=$numrecs;
}
if (!empty($next))
{
$lower += $numrecs;
$upper += $numrecs;
$offset += $numrecs;
}
if (!empty($prev))
{
$lower -= $numrecs;
$upper -= $numrecs;
$offset -= $numrecs;
}
#To use with LIMIT statement of Select
*******************************************************
Now THIS IS THE PART I AM NOT ABLE TO UNDERSTAnd
*******************************************************
## submitting two queries
## one for page1
## second to find out the entire list
$query1="select * from $table1 where prodclass like
'%$keyword%' order by prodclass limit ". ($offset != 0
? "$offset, $numrecs" : "$numrecs");
$query1a="select * from $table1 where prodclass like
'%$keyword%' order by prodclass";
Please can anybody explain me the limit statement..
Thanx a lot!
I am eagerly waiting for replies to this email.
Dhaval Desai
__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/