I have MySQL table called Files
which has file_id
column and file_type
column (and also other columns that are not relevant to the question).
I would like to get all file_id
s of all picture files (i.e. file_type='picture'
).
I do the query like this:
$pictures_query = mysql_query("SELECT file_id FROM Files WHERE file_type='picture')
and now the question is: how would I put all picture file_id
s into an array ?
I thought to do this like that:
$pictures_ids = array();
while ($row = mysql_fetch_row($pictures_query)) {
$pictures_ids[] = $row[0];
}
Does the loop really necessary, or there is a better way to do this ?