2010-10-06 4 views
0

J'ai deux tables mysql db, des photos et un album, je voudrais lister les photos par album comment je fais ça?Comment faire pour classer les photos par catégorie en php

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`) 
) 

Répondre

0

Vous ne savez pas sur la syntaxe, mais quelque chose comme ça

SELECT * FROM photos GROUP BY album_id; 

pourrait faire l'affaire.

Questions connexes