【发布时间】:2011-01-05 15:10:52
【问题描述】:
数据库结构:
id galleryId type file_name description
1 `artists_2010-01-15_7c1ec` `image` `band602.jpg` `Red Umbrella Promo`
2 `artists_2010-01-15_7c1ec` `image` `nov7.jpg` `CD Release Party`
3 `artists_2010-01-15_7c1ec` `video` `band.flv` `Presskit`
我将为应用程序的一个部分提取图像,在另一个部分提取视频等。像这样为每个部分进行多个 mysql 查询是否更好:
$query = mysql_query("SELECT * FROM galleries WHERE galleryId='$galleryId' && type='image');
...或者我应该构建一个关联数组,并在需要使用结果集时一遍又一遍地遍历数组?
感谢您的想法。
【问题讨论】:
标签: php mysql foreach associative-array