Argh ! array help required :(
| From: | Aaron Wolski | Date: | Wed, 05 Feb 2003 17:13:27 +0000 |
| Subject: | Argh ! array help required :( | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25457@lists.php.net to get a copy of this message | ||
Hi All,
Again.. a little off topic - sorry (again!).
Have a form that allows me to select a bunch of product names from a
drop down combo box.
I'm trying to create code like "in ('Product name1','Product Name2) to
be inserted into an SQL statement.
I figured that since $products was ALREADY in an array format the code
below would work.. but it doesn't:
$prod_search = "in(";
for ($i=0;$i<count($products);$i++) {
$prod_search .= escapeValue($products[$i]);
if ($i != (count($products) - 1)) {
$prod_search .= ",";
}
}
$prod_search .= ")";
Can anyone see where I am going wrong?
Thanks!
Aaron