|
 |
|
ช่วยหน่อยครับเกี่ยวกับตารางครับ ขอบคุณที่แนะนำครับ |
|
 |
|
|
 |
 |
|
จากโค๊ตจะได้รูป ปฏิทิน เรียงแบบ บน ลง ผมต้ออยากให้เรียง จากซ้ายไปขวา แถวละ 3 ผมจะทำไงดีครับ แทรกตารางไม่ถูกเลย ช่วยแนะนำหน่อยครับ ขอบคุณครับ
Code (PHP)
<style type="text/css">
th {
font-size:12pt;
line-height:14pt;
font-family:Helvetica,Arial;
}
</style>
<?php
$year=date(Y);
//echo"$year";
echo"<table border='1' width='200'> ";
for($month=1;$month<13;$month++)
{
printf("<tr>
<th colspan='7'>%s</th>
</tr> ",date("F",mktime(0,0,0,$month,1,$year)));
printf("<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>");
$fdom=date("w",mktime(0,0,0,$month,1,$year));
$ct=0;
for($row=1;$row<7;$row++)
{
//print("<tr>");
for($week=1;$week<8;$week++)
{
$ct++;
$value=mktime(0,0,0,$month,$ct-$fdom,$year);
if (date("m",$value)==$month)
{
printf ("<td>%s</td>",date("j",$value));
}
else
{
print("<td> </td>");
};
};
print("</tr>");
};
//print("<td colspan='7'><br /><br /></td>");
};
print("</table>");
?>
จากโค๊ตจะได้รูป ปฏิทิน เรียงแบบ บน ลง ผมต้ออยากให้เรียง จากซ้ายไปขวา แถวละ 3 ผมจะทำไงดีครับ แทรกตารางไม่ถูกเลย ช่วยแนะนำหน่อยครับ ขอบคุณครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2010-09-10 22:14:28 |
By :
kasuya191 |
View :
728 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตัวอย่างนี้เลยครับ ง่าย ๆ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die(mysql_error());
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM gallery";
$objQuery = mysql_query($strSQL);
echo"<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
echo "<td>";
$intRows++;
?>
<center>
<img src="thaicreate/<?=$objResult["Picture"];?>"><br>
<?=$objResult["GalleryName"];?>
<br>
</center>
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
}
echo"</tr></table>";
?>
</body>
</html>
<?
mysql_close($objConnect);
?>
Go to : PHP MySQL Multiple Column
|
 |
 |
 |
 |
Date :
2010-09-11 08:31:00 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|