|
Posted by Richard Lynch on 10/08/58 11:11
On Tue, March 22, 2005 11:30 pm, Ryan A said:
> $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");
This is pretty much a MySQL question, really...
But: There is a new-ish SQL_CALC_FOUND_ROWS constant you can use in your
query to get MySQL to tell you how many rows you would have gotten without
the LIMIT clause. You may be able to use that.
> 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?
Probably.
But since you only told us "it gives me an error" and don't tell use
*WHAT* the error is, we really can't help you, can we?
> $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);
Hmmmm. Actually, I *can* tell you that you shouldn't have FROM in there
twice. You've messed up your query something awful with that.
--
Like Music?
http://l-i-e.com/artists.htm
[Back to original message]
|