how to select last images from album DB

DB

i have

zp_albums ID parent folder
1 NULL furniture
4 1 furniture/chair
3 NULL wood-sculpture

zp_images ID albumid filename title
1 4 1.jpg sometitle
3 3 2-1.jpg sometitle

in my file

<?php
$cate_id = '3,4';
$pagelen = 10;

$conn = mysql_connect("localhost", "xxx", "xxx");
mysql_select_db("xxx");
$sql = "SELECT * FROM zp_albums a,zp_images b";
$sql .= " WHERE a.id = b.albumid IN ($cate_id)";
$sql .= " ORDER BY ";
$sql .= " b.id ";
$sql .= " DESC ";
$sql .= " LIMIT 0 , $pagelen ";
$result = mysql_query($sql);
while ($data = mysql_fetch_array($result)) {

echo "<img src='./albums/".$data["folder"]."/".$data["filename"]."' alt='".$data["title"]."' border='0' class='frame-thumb-gallery' />";

}
?>

Two problem in my code

".$data["folder"]." is alway show funiture

:(

help me pls...

Comments

Sign In or Register to comment.