Re: Multiple select list box to search mysql database
| From: | Bogdan Stancescu | Date: | Wed, 02 Jan 2002 04:03:27 +0000 |
| Subject: | Re: Multiple select list box to search mysql database | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-15297@lists.php.net to get a copy of this message | ||
Bogdan Stancescu wrote:
> In HTML:
> <SELECT name="manufacturernames[]" multiple>
> (note the name has PHP-like array definition)
>
> In PHP:
> for ($i=0;$i<sizeOf($manufacturernames);$i++) {
> if ($i==0) {
> $q_cond="where";
> } else {
> $q_cond="or";
> }
> $query.="$q_cond MANUFACTURER LIKE '$manufacturernames[$i]' ";
>
> }
You'll have to add another space at the beginning/end of the appended string for
the query to be ok...
Bogdan