|
 |
|
ต้องการดึงข้อมูลจากฐานข้อมูล แล้วให้ข้อมูลโชว์ข้อมูลแบบเป็นตัวแปล |
|
 |
|
|
 |
 |
|
ต้องการให้ข้อมูลที่ได้มาจากฐานข้อมูลเช่น A,B,C แต่เวลาแสดง ให้แสดง 1,2,3 คือให้ A=1,B=2,C=3 ต้องทำยังไงตอนนี้ดึงข้อมูลมาได้แล้วแต่มันแสดง A,B,C อยากให้มันแสดงเป็น 1,2,3 แทน แนะนำที
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-01-05 10:54:31 |
By :
ooaunjioo |
View :
941 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาแบบ Basic นะครับ
สมมุติว่าข้อมูลที่คุณดึงขึ้นมาเป็น A แล้วอยากให้มันแสดงเป็น 1 ก็เอา If else ไปดักเลยครับ ตัวอย่าง
.
.
.
.
.
Code (PHP)
while($data=mysql_fetch_array($Query1))
{
$data1=$data['info1'];
$data2=$data['info2'];
$data3=$data['info3'];
if($data1='A')
{
echo '1';
}
else if($data2='B')
{
echo'2';
}
}
ประมาณนี้พอได้มั้ยครับครับ
|
 |
 |
 |
 |
Date :
2012-01-05 13:53:00 |
By :
Chaan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
.
|
ประวัติการแก้ไข 2012-01-05 15:53:42 2012-01-05 15:54:04
 |
 |
 |
 |
Date :
2012-01-05 15:53:21 |
By :
oasiis |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
Load balance : Server 04
|