[PHP-DB] Search results of a previous query?

2004-02-18 Thread Lic. Carlos A. Triana Torres
Hi all,
I am trying to build a script to make nested searches in a table. I have a form 
compossed of a text field and a select dropdown menu with all the fields in the table. 
The user can write in the text box and then select the field in which to perform the 
search. This works fine so far...now, I want to show the results of the query, but 
give the user the possibility of searching again BUT only make the search with the 
results shown, not the entire tablecan anyone give me any ideas of how to do this 
last part? I tried passing the new queries in the url...but this won't give the user 
the possibility to search twice in the same field...
Any ideas? Thanks before hand.


Re: [PHP-DB] Search results of a previous query?

2004-02-18 Thread Ricardo Lopes
You can concat to the 1º filter statement the 2º. ex:

SELECT * FROM atable WHERE (fieldname = fieldvalue) AND (fieldname2 =
fieldvalue2)

For the user to search twice in the same field i think you have to use the
LIKE operator instead of the = and use the % in the string as wildcard. ex:

1º Search:  Name = %Carlos%// Will return all Carlos
2º Search:  Name = %Triana%// Will return everybody that have
Carlos and Triana in any part of their name if used a sql like the one above
(with AND).

This could be done how many times you want with only one field or several.

Hope this Hepls.

- Original Message -
From: Lic. Carlos A. Triana Torres [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 18, 2004 1:36 PM
Subject: [PHP-DB] Search results of a previous query?


Hi all,
I am trying to build a script to make nested searches in a table. I
have a form compossed of a text field and a select dropdown menu with all
the fields in the table. The user can write in the text box and then select
the field in which to perform the search. This works fine so far...now, I
want to show the results of the query, but give the user the possibility of
searching again BUT only make the search with the results shown, not the
entire tablecan anyone give me any ideas of how to do this last part? I
tried passing the new queries in the url...but this won't give the user the
possibility to search twice in the same field...
Any ideas? Thanks before hand.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php