Re: querying results already queryed once before
| From: | CC Zona | Date: | Tue, 15 Jan 2002 19:39:26 +0000 |
| Subject: | Re: querying results already queryed once before | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80615@lists.php.net to get a copy of this message | ||
In article <sc443c05.002@cis27.hosts.jhmi.edu>,
pschwar@jhmi.edu (Phil Schwarzmann) wrote:
> Dumb question: How do I query results from a MySQL that I've already
> queried once before in the same page?
>
> Here is my code:
>
> // querying the database for the first time.
> $query = "select * from table where thingA = $searchA";
> $result = mysql_query ($query);
>
> // now I want to query my results I just made.
If you merely want to re-use the result set, see
<http://www.php.net/manual/en/function.mysql-data-seek.php>.
If you want to do something more akin to a subquery (i.e. extracting a
subset of data from the original query's result set), then use a new SQL
statement. For example:
$query2="select * from table where thingA=$searchA and thingB=$searchB";
$result2 = mysql_query ($query2);
--
CC