|
|
|
ช่วยดู โค้ด แสดงข้อมูลจากฐานข้อมูล เรียงลำดับ 1 2 3 4 5 |
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2011-11-01 16:35:04 |
By :
ts02079684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$sql="select * from teacher order by user_id";
กำหนดให้ user_id ชนิด Int ก็ได้ครับ
|
|
|
|
|
Date :
2011-11-01 16:44:03 |
By :
dexjanghan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองดูนะ
Code (PHP)
<?
if($strsearch=="Y"){
$sql="select * from teacher Where name like '%".$search."%' ORDER BY name ASC ";
}else{
$sql="select * from teacher";
}
$dbquery=mysql_db_query($dbname, $sql);
while($result=mysql_fetch_array($dbquery))
{
$id_teacher=$result[id_teacher];
$name=$result[name];
$x=1;
if($bg == "#DFE6F1") { //ส่วนของการ สลับสี
$bg = "#E7F0FA";
} else {
$bg = "#DFE6F1";
}
echo"<tr class='text' bgcolor='$bg' >
<td align='center'>$x</td>
<td> $name</td>
<td align='center'><a href='add_user.php?edit_user_id=$user_id' class='textnormal'>แก้ไข</a> | <a href='delete-function.php?del_user_id=$user_id' class='textnormal'>ลบ</a></td>
</tr>";
$x++;
}
?>
|
ประวัติการแก้ไข 2011-11-01 16:55:38
|
|
|
|
Date :
2011-11-01 16:55:04 |
By :
yuyu7878 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
if($strsearch=="Y"){
$sql="select * from teacher Where name like '%".$search."%' ORDER BY name ASC ";
}else{
$sql="select * from teacher";
}
$dbquery=mysql_db_query($dbname, $sql);
while($result=mysql_fetch_array($dbquery))
{
$id_teacher=$result[id_teacher];
$name=$result[name];
if($bg == "#DFE6F1") { //ส่วนของการ สลับสี
$bg = "#E7F0FA";
} else {
$bg = "#DFE6F1";
}
echo"<tr class='text' bgcolor='$bg' >
<td align='center'><?php echo $i += 1; ?></td>
<td> $name</td>
<td align='center'><a href='add_user.php?edit_user_id=$user_id' class='textnormal'>แก้ไข</a> | <a href='delete-function.php?del_user_id=$user_id' class='textnormal'>ลบ</a></td>
</tr>";
}
?>
|
|
|
|
|
Date :
2011-11-01 16:57:47 |
By :
ไวยวิทย์ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมาก ครับบบ
|
|
|
|
|
Date :
2011-11-01 18:21:08 |
By :
ts02079684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?
if($strsearch=="Y"){
$sql="select * from teacher Where name like '%".$search."%' ORDER BY name ASC ";
}else{
$sql="select * from teacher";
}
$dbquery=mysql_db_query($dbname, $sql);
$x=1;
while($result=mysql_fetch_array($dbquery))
{
$id_teacher=$result[id_teacher];
$name=$result[name];
if($bg == "#DFE6F1") { //ส่วนของการ สลับสี
$bg = "#E7F0FA";
} else {
$bg = "#DFE6F1";
}
echo"<tr class='text' bgcolor='$bg' >
<td align='center'>$x</td>
<td> $name</td>
<td align='center'><a href='add_user.php?edit_user_id=$user_id' class='textnormal'>แก้ไข</a> | <a href='delete-function.php?del_user_id=$user_id' class='textnormal'>ลบ</a></td>
</tr>";
$x++;
}
?>
น่าจะใช้ได้แล้วนะอันเนี้ย พลาดไปนิดรีบกลับบ้าน อ่ะ
|
ประวัติการแก้ไข 2011-11-02 09:50:29
|
|
|
|
Date :
2011-11-02 09:50:05 |
By :
yuyu7878 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|