Re: Array Select from database
| From: | Silvio Porcellana | Date: | Wed, 28 Sep 2005 16:37:16 +0000 |
| Subject: | Re: Array Select from database | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-223364@lists.php.net to get a copy of this message | ||
A.J. Brown wrote:
>
> [code]
> $values = join(', ', $array);
> $query = "SELECT * FROM client WHERE clientaccountmanager IN ('$values')"
> [/code]
>
Actually this doesn't seem right, the join should be:
$values = join("', '", $array); # notice the ' inside the "
In addiction, I would (SQL)escape the values joined: supposing you are
using MySQL, I'd do:
$values = join("', '", array_map('mysql_real_escape_string', $array));
HTH, cheers
Silvio