Re: Querying a database for 50 users' information: 50 queries or a WHERE array?
| From: | David Harkness | Date: | Tue, 13 Sep 2011 16:48:21 +0000 |
| Subject: | Re: Querying a database for 50 users' information: 50 queries or a WHERE array? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314801@lists.php.net to get a copy of this message | ||
On Tue, Sep 13, 2011 at 7:29 AM, Ashley Sheridan
<ash@ashleysheridan.co.uk>wrote:
> SELECT * FROM table WHERE userID IN (1,2,3,4,5,etc)
>
+1. And this is a great place to use implode():
$sql = 'select ... where userID in (' . implode(',', $ids) . ')';
David