|
 |
|
ช่วยดูให้หน่อยครับ ดึงข้อมูล 2ตาราง มาแสดง 2 DropDownList |
|
 |
|
|
 |
 |
|
คือต้องการอะไรครับ
แค่ต้องการจะแสดงข้อมูลในแบบ option ให้เลือก โดยดึงข้อมูลจากสองตารางที่สัมพันธ์กันแค่นี้เหรอ
ยังไม่เข้าใจความต้องการน่ะ
|
 |
 |
 |
 |
Date :
2012-07-03 20:01:57 |
By :
บังเอิญผ่านมาเห็น |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
วิธีนี้ได้ผลคับ ลองประยุกต์ดู คับ ^^
<?php
include("lib/utility.php");
connect_db();
$sql = "SELECT TB_CUSTOMER.CUT_NAME,TB_AUDIT.USED FROM TB_AUDIT,TB_CUSTOMER WHERE TB_AUDIT.CUT_ID = TB_CUSTOMER.CUT_ID";
$resault = mysql_query($sql) or die (mysql_error());
$resault2 = mysql_query($sql) or die (mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
select1 :
<select name="select" id="select">
<?php while($row1 = mysql_fetch_array($resault)){?>
<option value="<?php echo $row1["CUT_NAME"]; ?>"><?php echo $row1["CUT_NAME"]; ?></option>
<?php } ?>
</select>
<br />
select2 :
<select name="select2" id="select2">
<?php while($row2 = mysql_fetch_array($resault2)){?>
<option value="<?php echo $row2["USED"]; ?>"><?php echo $row2["USED"]; ?></option>
<?php } ?>
</select>
</form>
</body>
</html>
ผลการทำงานคับ

|
ประวัติการแก้ไข 2012-07-03 20:31:39
 |
 |
 |
 |
Date :
2012-07-03 20:28:41 |
By :
tttpongsak |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|