|
|
|
ช่วยแก้โค๊ด ดึงรูปมาเป้นตาราง คอลัม3 และให้มันขึ้นอีกแถวด้วยนะ ขอบคุณมากกก |
|
|
|
|
|
|
|
Code (PHP)
<?PHP
include("conf/connectDB.conf.php");
$sql = "SELECT b.img_file,a.adv_id, a.adv_notice, a.show_date FROM advertises AS a LEFT OUTER JOIN images AS b ON a.adv_id = b.adv_id WHERE a.adv_type = 'S' AND a.show_flag = '1' AND zone = 'Center' GROUP BY a.adv_id HAVING DATEDIFF(CURDATE(),a.show_date) <= 7 AND (MAX(b.img_id) OR b.img_file IS NULL)";
$result = mysql_query($sql) or die(mysql_error());
$cols = 3; // จำนวนคอลัมน์ที่ต้องการ
$i = 1;
echo "<tr>";
while($rows = mysql_fetch_assoc($result)){
if($i > $cols){
$i = 1;
echo ' </tr><th width="202" scope="row">';
}else{
echo ' <th width="202" scope="row">';
}
echo '<div style="clear:both;">';
if($rows["img_file"] != ""){
$size = getimagesize('advertise/uploads/' . $rows["img_file"]);
//$width = ($size[0] > 100)? 100 : $size[0];
$width = ($size[0] > 100)? 150 : $size[0];
echo '<div style="display:inline-block; width:' . $width . 'px; border:solid 1px #ccc; padding: 1px; background: #eee;">
<a href="advertise/view.php?id='.$rows['adv_id'].'"><img src="advertise/uploads/' . $rows["img_file"] . '" width="' . $width . '" border=0></a></div>';
}
echo '<div style="font:12px tahoma;padding-bottom:10px;">'. $rows["adv_notice"] .'</div>';
echo '</th>';
echo '</div>';
$i++;
}
echo "</tr>";
?>
|
|
|
|
|
Date :
2010-02-09 15:28:04 |
By :
windersun |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากๆ ใจดีมากเลย
|
|
|
|
|
Date :
2010-02-09 15:59:30 |
By :
popoposw |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ดีจัยด้วยนะ 55
|
|
|
|
|
Date :
2010-02-09 19:25:58 |
By :
unzeen |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|