【发布时间】:2010-10-07 16:58:49
【问题描述】:
我有一个 Mysql 记录集,我已将它放入关联数组中,以便我可以反复重用它。
我使用这个函数将值放入数组中:
while(($Comments[] = mysql_fetch_assoc($rsComments)) || array_pop($Comments));
这是 print_r($Comments) 显示的内容
Array ( [0] => Array ( [CommentID] => 10 [Comment] => Ouch [CommentAuthor] => Randy Krohn [CommentDate] => 2010-10-06 17:19:49 [ID] => 1231 [CategoryID] => 42 ) [1] => Array ( [CommentID] => 12 [Comment] => This is the Dirty Duck [CommentAuthor] => John Lemoine [CommentDate] => 2010-10-06 17:22:43 [ID] => 1411 [CategoryID] => 42 ) [2] => Array ( [CommentID] => 13 [Comment] => Talk about deja vu! [CommentAuthor] => dber [CommentDate] => 2010-10-06 17:24:48 [ID] => 1473 [CategoryID] => 42 ) )
我正在循环浏览图像列表,并且我只想显示与指定 ImageID(例如 1473)的图像关联的 cmets。
我只需要显示ID等于指定值的那些吗?
这一定很容易,但由于某种原因,它只是在我头上飞过。
感谢您的帮助!
【问题讨论】:
标签: php mysql associative-array