0

I'm trying to figure out if this is possible, and cannot find any information about it.

Specifically what I want to do, for example, is allow a web-based user to search for a particular value in one field the first time around. If that returns an overwhelming number of results, I'd like for them to be able to search from within the results of the first query.

I suppose I could have the prior query statement POSTed with the results and nest a bunch of statements, but this seems like it could get really ugly in a hurry. :eek:

Any ideas?

4
Contributors
4
Replies
6
Views
12 Years
Discussion Span
Last Post by edshuck
0

Hmm, no, a subquery is just a one-time thing, too. I'm talking about subsequent calls to the mysql_query() function.

For example, let's say I have a database with tons of records. Here's the first query, which returns thousands of results:

$query="SELECT * FROM sometable WHERE [some condition]";
$result=mysql_query($query);

[at this point, code execution has stopped and the user is on a different page. The user decides to narrow the search, so I'd like to know if there is something akin to the following]

$query2="SELECT * FROM $result where [condition2]";
$result2=mysql_query($query2);

Where $result is a pointer to a table in memory containing the rows that were pulled in the first query.

0

Mmmm... maybe creating a temporary table with the results of the first query but that will kill performance. In my opinion it is better to create a seach form that "remembers" the values and then the client can always have that reference and change the options to narrow the search.

0

My site is a community (neighborhood) site and there are all manner of products available at shops. This is my category area.

I do this:

super category >> many to many >> category >> many to many >> shop.

I start with a super category (say dining). Click it and the many to many has dining pointing to Chinese, Italian, Catering and so on. This is displayed. Then the viewer selects the specific category and then the full select statement is put into effect.

Hope this helps.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.