|
Posted by Janwillem Borleffs on 01/15/06 02:16
gooze wrote:
> Thank you for your answer. Actually I store the pictures in the DB
> because they belong to the records fields. In this case it would be
> meaningless to store the pictures on the filesystem, since there are
> thousands of them and they are very small.
>
> Just wondering if there is a way with only one query.
>
Well, you could use something like:
SELECT icon FROM pictures WHERE id=$id and id=$id2 and $id=$id3...
Constructing the query from an array with ids would go as follows:
$ids = array(1,2,3,4,5,6);
$query = 'SELECT icon FROM pictures WHERE id=' . implode(' AND id=', $ids);
PS: Don't forget to escape user input which gets parsed into a query, e.g.
with the following function:
http://www.php.net/manual/en/function.mysql-escape-string.php
JW
[Back to original message]
|