help needed building query string based on which form fields that are filled.
| From: | anders thoresson | Date: | Sat, 01 Feb 2003 20:18:34 +0000 |
| Subject: | help needed building query string based on which form fields that are filled. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133904@lists.php.net to get a copy of this message | ||
Hi,
I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled?
My guess is that I can do something like this:
if(!empty($f_name)) {
some_commands_to_add_$f_name_to_querystring
}
if(!empty($l_name)) {
some_commands_to_add_$f_name_to_querystring
}
some_commands_to_build_querystring_based_on_if's
$result = mysql_query($query)
But what commands/functions should I use to build the query?
--
anders thoresson