> -----Original Message-----
> From: Smita Manohar [mailto:[EMAIL PROTECTED]]
> Sent: Monday, August 26, 2002 8:26 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] next prev links for search result
> i want page no. and next prev links while displaying search
> result. the
> script which im using presently, needs to run the search
> query 2 times for
> each search operation.
> first time it finds all the records matching the query string,
Change this query:
> ie, select * from table where field like '%$search_string %'
SELECT COUNT(*) AS num_hits FROM table WHERE field LIKE '%$search_string%'
and let your MySQL-server do the counting. No need to transfer all data to
PHP just to count the rows.
You still have to run two queries, but I don't think you need to worry too
much about performance issues, unless you have a really, really huge table.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php