count with match probelm
| From: | Ryan A | Date: | Wed, 23 Mar 2005 07:30:39 +0000 |
| Subject: | count with match probelm | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-211334@lists.php.net to get a copy of this message | ||
Hi,
I am running this kind of a statement:
$q=mysql_query("select cno,date_and_time,MATCH(ad_sub, ad_text)
AGAINST('$words') AS score from ".$tcname."ads WHERE MATCH(ad_sub, ad_text)
AGAINST('$words') AND is_confirmed=1 LIMIT $limit1, $limit2");
which is running fine...my problem is I am using a class for pagination
which requires the total number of records that will be returned to break
the query into pages....and which will give me the values of $limit1 and ,
$limit2 which i will use in the above statement...but running a count() is
not working, it gives me an error, what other options do i have other than
running the same query twice and using mysql_num_rows? (which i think would
be quite intensive/wasteful as i am querying @ 100 rows each time)
This is my count() query, maybe theres a problem here?
$how_many = mysql_result(mysql_query("SELECT COUNT(*), MATCH(ad_sub,
ad_text) AGAINST('$words') AS score from ".$tcname."ads WHERE MATCH(ad_sub,
ad_text) AGAINST('$words') FROM ".$tcname."ads where is_confirmed=1"),0);
Thanks in advance,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.0 - Release Date: 3/21/2005