Reply to Re: Displaying pictures

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация