Re: Searching within a range
| From: | 1LT John W. Holmes | Date: | Fri, 28 Jun 2002 14:03:36 +0000 |
| Subject: | Re: Searching within a range | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104327@lists.php.net to get a copy of this message | ||
>I want to search within a result from a query
>A specific range (price)
If that's what you really want, then you need to save the results of your
first query into a table that you can re-query at a later date. Run a cron
job to delete old tables.
If your query is:
SELECT * FROM main WHERE price BETWEEN 0 AND 50;
Then you would use
CREATE TABLE temp_random_name SELECT * FROM main WHERE price BETWEEN 0 AND
50;
And when you need to re-query, select from 'temp_table_name'
uniqid will come in handy for making table names. www.php.net/uniqid. Note
that you don't want to create a mysql temporary table, i.e. CREATE TEMPORARY
TABLE ..., because that table will be removed at the end of the connection,
i.e. the end of the script. So it won't be available for the next script to
re-query from.
---John Holmes...