|
|
|
ช่วยแก้โค้ดตารางเรียนให้หน่อยค่ะ คือยากให้มัน insert ข้อมูลลง database |
|
|
|
|
|
|
|
Code (PHP)
<?php
$connectdb=mysql_connect("localhost","test","admin")or die("no connect database");
mysql_query("SET CHARACTER SET utf8");
mysql_query("use project");
$group =$_POST['Group'];
$sql = "
SELECT rpsd_id FROM room_period_school_days WHERE room_id ORDER BY rpsd_id ASC
";
$res = mysql_query($sql);
while ($row = mysql_fetch_array($res)) {
$rpsd_id = $row['rpsd_id'];
//echo $rpsd_id . "<br />";
$status = $_POST['rpsd_id_' . $rpsd_id];
if($status != "Y"){
$status = "0";
}else{
$status = $group;
}
//echo $status . "<br />";
$strSQL = "UPDATE room_period_school_days SET ";
$strSQL .="status = '".$status."' ";
$strSQL .= "where rpsd_id=".$row['rpsd_id'];
mysql_query($strSQL);
}
header('Location: test.php');
?>
|
|
|
|
|
Date :
2012-03-10 15:03:51 |
By :
rungjanjira |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|