|
|
|
หลังจากRefresh page อยากให้ตารางโชว์ฟิวล์ที่เพิ่ง Update หรือเพิ่ง Add |
|
|
|
|
|
|
|
นี่เป็น Source Code ของผมครับ เผื่อพี่ ๆ ต้องการดูแล้วจะช่วยผม
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ตารางการแข่งขันฟุตบอล ยะลา F.A. คัพ ครั้งที่ 8</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<style type="text/css">
<!--
.style3 {font-size: 9px}
.style6 {font-size: 14px; }
.style7 {
font-size: 18px;
font-weight: bold;
}
.style8 {font-size: 16px; }
-->
</style>
</head>
<body>
<div align="center">
<p>
<?php
$host="localhost";
$username="root";
$password="";
$db="ball";
$tb="ball";
mysql_connect($host,$username,$password) or die ("ติดต่อกับฐานข้อมูล Mysql ไม่ได้ ");
mysql_select_db($db) or die ("เลือกฐานข้อมูลไม่ได้"); //ทำการเลือฐานข้อมูลก่อน
$sql="Select* From $tb";
$db_query=mysql_db_query($db,$sql);
$num_rows=mysql_num_rows($db_query);//นับ Record ที่พบ
?>
<strong>ตารางการแข่งขันฟุตบอล ยะลา F.A. คัพ ครั้งที่ 8<br>
<br>
</strong></p>
</div>
<table width="100%" border="1" align="center">
<tr>
<td width="4%">
<div align="center"><img src="images/g.jpg" width="19" height="19" longdesc="http://www.teenee.com"></div> </td>
<td width="12%" bgcolor="#6600FF">
<div align="center" class="style7">วัน เดือน ปี</div> </td>
<td width="7%" bgcolor="#6600FF">
<div align="center" class="style7">คู่ที่</div> </td>
<td width="11%" bgcolor="#6600FF">
<div align="center" class="style7">เวลา</div> </td>
<td width="24%" bgcolor="#6600FF">
<div align="center" class="style7">ทีม</div> </td>
<td width="3%" bgcolor="#6600FF">
<div align="center" class="style7">VS</div> </td>
<td width="24%" bgcolor="#6600FF">
<div align="center" class="style7">ทีม</div> </td>
<td width="7%" bgcolor="#6600FF">
<div align="center" class="style7">รอบ</div> </td>
</tr>
</table>
<?
$a=0;
while($a < $num_rows)
{
$result= mysql_fetch_array($db_query);
$id= $result[id];
$date = $result[date];
$matchs = $result[matchs];
$time = $result[time];
$team1=$result[team1];
$team2=$result[team2];
$around = $result[around];
{
if($bg == "#FFCC00") { //ส้มเข้ม (สีที่ 1
$bg = "ffff99"; //สีที่ 2
} else {
$bg = "#FFCC00";
}
}
?>
<table width="100%" border="1" align="center">
<tr bgcolor="<?=$bg?>">
<td width="4%" bgcolor="#FFFFFF"><center>
<a href="#" class="style3" onClick="MM_openBrWindow('ball_edit.php? id=<? echo $id ?> ','','scrollbars=yes,width=210,height=125')"><img src="images/g.jpg" width="19" height="19" border="0" align="absbottom"></a>
</center></td>
<td width="12%">
<div align="center" class="style8"><? echo "$date"; ?></div> </td>
<td width="7%">
<div align="center" class="style8"><? echo "$matchs"; ?></div> </td>
<td width="11%">
<div align="center" class="style8"><? echo "$time"; ?></div> </td>
<td width="24%">
<div align="center" class="style6"><? echo "$team1"; ?></div> </td>
<td width="3%">
<div align="center" class="style8"><strong>VS</strong></div> </td>
<td width="24%">
<div align="center" class="style6"><? echo "$team2"; ?></div> </td>
<td width="7%">
<div align="center" class="style6"><? echo "$around"; ?></div> </td>
</tr>
</table>
<?
$a++;
}
//echo"<center><br>จำนวน Record = $num_rows</center>";
mysql_close();
?>
<a href="#" class="style3" onClick="MM_openBrWindow('ball_add.htm','','scrollbars=yes,width=210,height=125')">เพิ่มข้อมูล</a>
<center>
<p align="left"> </p>
</center>
<META HTTP-EQUIV='Refresh' CONTENT='3;URL=ball.php'>
</body>
</html>
|
|
|
|
|
Date :
27 ธ.ค. 2550 11:43:00 |
By :
iamnuu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้าเป็นข้อมูลใหม่ ไม่เช็ค ID ล่าสุดมาแสดงหล่ะครับ แต่ถ้าเป็นตัวที่ Update ล่าสุด ก็เช็ควันและเวลา แทน น่าจะง่ายกว่านะครับ แล้วจะให้มัน วิ่ง ก็ทำทีหลังได้
|
|
|
|
|
Date :
27 ธ.ค. 2550 15:22:14 |
By :
peter |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
นั่นแหละครับ ผมเขียนโค้ดไม่ถูกครับ
|
|
|
|
|
Date :
2 ม.ค. 2551 15:17:32 |
By :
iamnuu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|