Re: Argh ! array help required :(

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 06 February 2003 01:13, Aaron Wolski wrote:
> 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?

  $doo = array('dah', 'dee', 'dib');
  $doo = "in ('" . implode("', '", $doo) . "')";
  echo $doo;

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
More are taken in by hope than by cunning.
		-- Vauvenargues
*/


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux