|
 |
|
ขอถามหน่อยครับ พอดีทำอยากทราบการแสดงค่า พอดีทำเรื่องการจองคอนโด อ่าครับ |
|
 |
|
|
 |
 |
|
ออกแบบตารางยังไง
Code (PHP)
<?php
$host = "localhost";
$database = "dbname";
$username_mk = "root";
$password_mk = "12345678";
$connect = mysql_connect($host, $username, $password) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database, $connect);
?>
<form name="form1" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="100%">
<tr>
<td>อาคาร</td>
<td>
<select name="select_building">
<option value="">- เลือกอาคาร -</option>
<?php
mysql_select_db($database, $connect);
$sql = "SELECT building_id,building_name FROM building";
$result = mysql_query( $sql, $connect);
while ($rs = mysql_fetch_array($result))
{
echo "<option value=\"$rs[building_id]\">$rs[building_name]</option>\n";
}
?>
</select>
<input name="submit" type="submit" value=" Search ">
</td>
</tr>
</table>
</form>
<?php
if (!empty($select_building)) {
$sql = "SELECT room_name FROM tablename WHERE building = '$select_building' AND status = 'ว่าง' "; //status= ชื่อฟิลที่เก็บสถานะ
$result = mysql_query( $sql, $connect);
while ($fd = mysql_fetch_array($result)) {
echo $fd['room_name'];
echo "<br>";
}//end while
}//end if
mysql_close($connect);
?>
|
ประวัติการแก้ไข 2011-04-21 09:52:15
 |
 |
 |
 |
Date :
2011-04-21 09:51:25 |
By :
avsqlz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|