|
 |
|
Loop แบบนี้ทำยังไงคับ ผมต้องการดึงข้อมูลจากฐานข้อมูลมาไว้บนแบรคกราวน์ที่เตรียมไว้ทั้งหมด |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
/*** By Weerachai Nukitram ***/
/*** http://www.ThaiCreate.Com ***/
?>
<html>
<head>
<title>ThaiCreate.Com Multiple Column</title>
</head>
<body>
<div align="center">
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM gallery ORDER BY GalleryID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
echo "<td>";
?>
<table width="91" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center"><a href="gallery/<?=$objResult["Picture"];?>" target="_blank"><img src="gallery/<?=$objResult["Thumbnails"];?>" width="70" height="53" border="0"></a></div></td>
</tr>
<tr>
<td><div align="center"><?=$objResult["GalleryName"];?></div></td>
</tr>
</table>
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
else
{
echo "<td>";
}
}
echo"</tr></table>";
?>
<?
mysql_close($objConnect);
?>
</div>
</body>
</html>
Ref : Multiple Column แสดงข้อมูลจากฐานข้อมูลด้วยการแบ่งออกเป็นหลาย Column
|
 |
 |
 |
 |
Date :
2009-11-06 21:25:32 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$bgs = array('a.gif', 'b.gif', 'c.gif', 'd.gif');
$bg_count = count($bgs);
$col_count = 2;
echo '<table border="1" width="500">';
while ($i < 10)
{
echo (++$index % $col_count) ? '<tr>' : '';
echo '<td background="'.$bgs[($index - 1) % $bg_count].'">aa';
$i++;
}
echo '</table>';
นี่แค่ตัวอย่างนะครับ 
http://gunner.freetzi.com
|
 |
 |
 |
 |
Date :
2009-11-06 21:41:39 |
By :
pjgunner |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ชอบคุณมากมายคับ เดี๋ยวลองทำดูคับ แล้วจะมารายงาน...
|
 |
 |
 |
 |
Date :
2009-11-06 22:14:18 |
By :
tcc |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|