|
 |
|
ผมอยากรู้ว่า ใช้คำสั่ง mysql ยังไงให้ เลือกข้อมูลรองจาก max id อะคับ |
|
 |
|
|
 |
 |
|
ใช้ php จัดการละกันน้อ
Code (PHP)
$result = mysql_query("select * from your_table_name order by id desc limit 2");
$count = mysql_num_rows($result);
if($count == 2){ // กรณีปกติคือมีมากกว่า 1 row
echo 'id : ' . mysql_result($result,1,0) . ', num : ' . mysql_result($result,1,1);
}else if($count == 1){ // กรณีมีแค่ 1 row
echo 'id : ' . mysql_result($result,1,0) . ', num : ' . mysql_result($result,1,1);
}else{
echo 'เสียใจด้วยไม่เจอข้อมูล';
}
|
 |
 |
 |
 |
Date :
2011-05-31 02:40:46 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เย้.....ทำได้แล้ว
ขอบคุณมากคับคุณพี่
|
 |
 |
 |
 |
Date :
2011-05-31 07:03:42 |
By :
ai9benjamin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากคับ
|
 |
 |
 |
 |
Date :
2011-06-03 02:10:35 |
By :
ai9benjamin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|