Jump to content

Somewhat Simple Count(*) question...


drbigfresh

Recommended Posts

I am trying to get the total # of results returned in my full text query, but I can't seem to figure it out. I think I have tried every variation and it is totally eluding me....

 

Here is the query....

SELECT id, description, MATCH(description) AGAINST('apple') AS score FROM feed WHERE MATCH(description) AGAINST('apple')  ORDER BY score DESC

 

When I just add a count(*) in there it only returns 1.

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/48204-somewhat-simple-count-question/
Share on other sites

If you're using count(*), you should request the first column of the first row of the result.  That will be your count.

 

$count = mysql_result($result, 0, 0);

 

But if you need to run the full query anyway, then mysql_num_rows() is better.  If you don't need to run the full query anyway, count(*) is better.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.