[PHP-DB] Refining my search app..

2002-12-02 Thread Ryan Christensen
Here's the skinny:

I'm starting development on a small search application & need some input
on a small roadblock I've run into..

What I need:

 - Script needs to be able to search database for matching queries in a
specified column. (Ex: from a dropdown list the user selects "foo" and
types in "bar" for a query.. we need to return all results matching
"bar" from the "foo" column.) Pretty basic, with the exception of the
second part:

 - Depending on the column-to-search they select from the drop-down
list, I need to change the structure of the query. This is needed
because SOME queries will need to be structured to select all records
from a column greater than / less than (insert number here) as opposed
to a standard select * where 'x' like '%y%' type query.

I would LIKE to keep the code relatively clean & don't want to flood it
with tons of "if" statements if at all possible.. which is why I'm
asking for your help. Any thoughts on a simple way to accomplish this?..
anyone tried something of this nature before?

Thank you in advance! Please let me know if you need additional detail..

Ryan


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




Re: [PHP-DB] Refining my search app..

2002-12-02 Thread Adam Voigt




A little cleaner:



switch($_POST[column])

{

case("foo"):$query = mysql_query("WHATVER");break;

case("too"):$query = mysql_query("BLAH");break;

default:$query = mysql_query("DOH");break;

}



while($row = mysql_fetch_array($query))

{

// DO SOMETHING

}





-- 
Adam Voigt ([EMAIL PROTECTED])
The Cryptocomm Group
My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc








signature.asc
Description: This is a digitally signed message part