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,
ie, select * from table where field like '%$search_string %'
then script stores total no. of records found. then it calculates no. of
pages required to display the result using total no. of records and limit(no
of records per page)
then i need to run the same search query using limit.
ie, select * from table where field like '%$search_sting %' limit $offset,
which find first few records (as per limit) to display.
then loops have been used to display page no. and next previous navigation.
in next prev links, i call the same file (php_self). that time i need to
pass some values ie, $limt, $search_string. otherwise these values get
vanish while running same script again.
in case of simple search form i need to pass only $search_string. but im
also having advance search form. now finding it difficult to pass the values
which user selects for adv. search. and its becoming too complecated.
also i don't want to run the same query 2 times.
the solution for this which i'm thinking is like this....
after accepting search options from user, run the query and store the result
in array. suppose that array contains 10 rows, means 10 records are found.
and limit (no of records per page ) is 2. while displaying first page get
only first 2 records from array (as per the limit) for the next link, get
next 2 records ie, 3,4 from array and same way for prev link.
with this logic i need to run the query once, and no need to pass any
argument while running same script again.
i don't know much abt array in php. so can't implement this idea.
need solution and suggestions for this.
hope, i could have explain my problem well :-)
thnx and regds,
Chat with friends online, try MSN Messenger: http://messenger.msn.com
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php