Do this query first to get a variable that holds the total number of rows matching your query.... count = mysql_result(mysql_query(SELECT COUNT(*) AS count FROM table WHERE condition, $link_id),"count"); I think this is the correct syntax... .bobo ----- Original Message ----- From: "Ross Honniball" <ross@xxxxxxxxxxxxxxxxxxx> To: <php-windows@xxxxxxxxxxxxx> Sent: Wednesday, May 12, 2004 10:30 AM Subject: Best way to tell how many rows a query returns > Hi folks, > > I'm using a mysql query with a LIMIT clause. The problem is I would like to > know how many rows WOULD have matched had the limit clause not been in > place. I realise that any solution is going to involve some over-head, but > what's the most efficient way to find out? > > eg. > > SELECT * FROM table WHERE conditions LIMIT 30,30 > > Say there are 200 records that match 'conditions', only 30 rows are > returned (of course). How do I find out the total number (200 in this case) > that matched the conditions? > > Any ideas? > > . Ross Honniball JCU Bookshop Cairns Supervisor > . James Cook Uni, McGreggor Rd, Smithfield, Qld. 4878, Australia > . Ph:07.4042.1157 Fx:07.4042.1158 Em:ross@xxxxxxxxxxxxxxxxxxx > . There are no problems. Only solutions. > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php