drbigfresh Posted April 23, 2007 Share Posted April 23, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/48204-somewhat-simple-count-question/ Share on other sites More sharing options...
bubblegum.anarchy Posted April 23, 2007 Share Posted April 23, 2007 The PHP function mysql_num_rows($result_id) will provide the row count after the query is processed. Quote Link to comment https://forums.phpfreaks.com/topic/48204-somewhat-simple-count-question/#findComment-235649 Share on other sites More sharing options...
btherl Posted April 23, 2007 Share Posted April 23, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/48204-somewhat-simple-count-question/#findComment-235658 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.