开发者

How to list photos by category in php

I have two mysql db tables, photos a开发者_如何学JAVAnd album, I would like to list photos by album how do i do that ?

CREATE TABLE `album` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `album_name` varchar(95) NOT NULL,
 `album_desc` text NOT NULL,
 PRIMARY KEY (`id`)
);


CREATE TABLE `photos` (
 `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
 `album_id` int(11) NOT NULL,
 `thumb_name` varchar(255) NOT NULL,
 `photo_name` varchar(250) NOT NULL,
 PRIMARY KEY (`id`)
) 


Not sure about the syntax but something like this

 SELECT * FROM photos GROUP BY album_id;

might do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜