lucan Posted September 21, 2011 Share Posted September 21, 2011 Need some help on my result counter. I am using a search box to return data from my database i can get the result returned fine but i am having problems getting the total number of result returned. It only returns the number of results per page as i am using a paginate. Can some one point me in the right direction. The number count im using is below. $num_rows = mysql_num_rows($sql); echo "$num_rows Results Found\n"; Quote Link to comment Share on other sites More sharing options...
requinix Posted September 21, 2011 Share Posted September 21, 2011 Change your query to say SELECT SQL_CALC_FOUND_ROWS ... LIMIT X, Y Run it as normal. Then run a second query afterwards SELECT FOUND_ROWS() to get the count. FOUND_ROWS() Quote Link to comment 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.