我想显示我的用户的图片,按日期分组,就像我附加的图片一样。我需要做什么?
我到目前为止:
$connect= //connection info;
$query= "SELECT * FROM posts WHERE user_id= $user_id AND picture= IS NOT NULL ORDER BY date DESC";
$result= ($connect, $query);
while ($row= mysqli_fetch_array($result)) {
echo '<img src="'.$row['picture']. '"/>' . "<br/>";
};
我的表结构:
| user_id | post_date | story | image |
|-------------------------------------|
| 14 | mar 2012 | BLOB | a.jpg |
| 14 | apr 2012 | BLOB | b.jpg |
| 14 | feb 2012 | BLOB | c.jpg |
| 14 | mar 2012 | BLOB | d.jpg |
|_____________________________________|
但是此代码仅显示用户收集的所有图像。我如何将它们分组?