|
|
|
อยากได้โค้ดสีที่เวลาหนูเลือกกลุ่มแล้วกลุ่มที่ เปลี่ยนสีแต่ละกลุ่มจามีสีไม่เหมือนกันค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<?php
$connectdb=mysql_connect("localhost","test","admin")or die("no connect database");
mysql_query("SET CHARACTER SET utf8");
mysql_query("use project");
//$sql="select * from room_period_school_days where room_id='".$_GET['room_id']."' ";
//echo $sql;
$sqlSchoolDays = "
SELECT
t1.school_days_id
, t2.school_days_name
, t2.school_days_status
FROM
room_period_school_days AS t1
LEFT JOIN school_days AS t2 ON t1.school_days_id=t2.school_days_id
WHERE t1.room_id = 1
GROUP BY t1.school_days_id
ORDER BY t1.school_days_id ASC
";
$resSchoolDays = mysql_query($sqlSchoolDays);
$sqlPeriod = "
SELECT
t1.period_id
, t2.period_time_start
, t2.period_time_end
FROM
room_period_school_days AS t1
LEFT JOIN period AS t2 ON t1.period_id=t2.period_id
WHERE t1.room_id = 1
GROUP BY t1.period_id
ORDER BY t1.period_id ASC
";
$resPeriod = mysql_query($sqlPeriod);
?>
</p>
<form action="testCMD.php" method="post" name="rpsd-form" id="rpsd-form">
<p align="center">เลือกกลุ่มและวันเวลาที่ต้องการใช้</p>
<p align="center">
<select name="Group" id="select">
<option value="1"> กลุ่ม1 </option>
<option value="2"> กลุ่ม2 </option>
<option value="3"> กลุ่ม3 </option>
<option value="4"> กลุ่ม4 </option>
<option value="5"> กลุ่ม5 </option>
</select>
</p>
<p align="center">
<table width="583" height="247" border="1">
<tr>
<td>วันที่/เวลา</td>
<?php
while ($rowPeriod = mysql_fetch_array($resPeriod)) {
echo '<td>'.$rowPeriod['period_time_start'].' - '.$rowPeriod['period_time_end'].'</td>';
}
?>
</tr>
<?php
while ($rowSchoolDays = mysql_fetch_array($resSchoolDays)) {
echo'<tr>';
echo '<td>'.$rowSchoolDays['school_days_name'].'</td>';
$sqlRPSD = "
SELECT * FROM room_period_school_days
WHERE
school_days_id = ".$rowSchoolDays['school_days_id']."
AND room_id = 1
ORDER BY period_id ASC
";
$resRPSD = mysql_query($sqlRPSD);
while ($rowRPSD = mysql_fetch_array($resRPSD)) {
$checked = "";
$ee = $rowRPSD['status'];
if($rowRPSD['status'] == "Y"){
$checked = "checked";
}
if($rowRPSD['statusroom'] == "0" )
{
echo '<td><input type="checkbox" name="rpsd_id_'.$rowRPSD['rpsd_id'].'" value="Y" '.$checked.' /></td>';
}else
{
echo "<td>กลุ่มที่$ee จองแล้ว </td>";
}
}
echo'</tr>';
}
?>
|
|
|
|
|
Date :
2012-03-21 16:08:03 |
By :
AA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่มีใครตอบเลย
|
|
|
|
|
Date :
2012-03-21 16:51:41 |
By :
AA |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<?
$i=0;
while($objResult = mysql_fetch_array($objQuery))
{
$i++;
if($i%2==0)
{
$bg = "#CCCCCC";
}
else
{
$bg = "#FFFFFF";
}
?>
<tr bgcolor="<?=$bg;?>">
<td><div align="center"><?=$objResult["CustomerID"];?></div></td>
<td><?=$objResult["Name"];?></td>
<td><?=$objResult["Email"];?></td>
<td><div align="center"><?=$objResult["CountryCode"];?></div></td>
<td align="right"><?=$objResult["Budget"];?></td>
<td align="right"><?=$objResult["Used"];?></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>
ตัวอย่างครับ
|
|
|
|
|
Date :
2012-03-21 18:14:26 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|