include("conn.php") ;
$jan = $_POST['jan'];
$feb= $_POST['feb'];
$mar= $_POST['mar'];
$q1= $_POST['q1'];
$apr= $_POST['apr'];
$may= $_POST['may'];
$jun= $_POST['jun'];
$q2= $_POST['q2'];
$jul= $_POST['jul'];
$aug= $_POST['aug'];
$sep= $_POST['sep'];
$q3= $_POST['q3'];
$oct= $_POST['oct'];
$nov= $_POST['nov'];
$dece= $_POST['dece'];
$ytd= $_POST['ytd'];
$k_id= $_POST['k_id'];
$year= $_POST['year'];
$Submit2 = $_POST['Submit2'];
$f_id = $_POST['f_id'];
$sql[0] = "update form set jan='$jan' where f_id='$f_id' ";
$sql[1] = "update form set feb='$feb' where f_id='$f_id' ";
$sql[2] = "update form set mar='$mar' where f_id='$f_id' ";
$sql[3] = "update form set apr='$apr' where f_id='$f_id' ";
$sql[4] = "update form set may='$may' where f_id='$f_id' ";
$sql[5] = "update form set jun='$jun' where f_id='$f_id' ";
$sql[6] = "update form set jul='$jul' where f_id='$f_id' ";
$sql[7] = "update form set aug='$aug' where f_id='$f_id' ";
$sql[8] = "update form set sep='$sep' where f_id='$f_id' ";
$sql[9] = "update form set oct='$oct' where f_id='$f_id' ";
$sql[10] = "update form set nov='$nov' where f_id='$f_id' ";
$sql[11] = "update form set dece='$dece' where f_id='$f_id' ";
$sql[12] = "update form set q1='$q1' where f_id='$f_id' ";
$sql[13] = "update form set q2='$q2' where f_id='$f_id' ";
$sql[14] = "update form set q3='$q3' where f_id='$f_id' ";
$sql[15] = "update form set ytd='$ytd' where f_id='$f_id' ";
for($i=0;$i<16;$i++) {
$result = mysql_query($sql[$i]) or die(mysql_error()) ;
}
echo "<br><br><center><font size=\"3\" face='Tahoma'><b>บันทึกเพิ่มแล้ว</b></font></center>" ;
echo "<meta http-equiv='refresh' content='2; url=main.php?dept_id=$dept_id'>" ;
Tag : PHP, MySQL
Date :
2011-05-31 16:06:28
By :
pumhonda
View :
4766
Reply :
7
No. 1
Guest
ตั้งค่าปริยายจาก notnull ให้เป็น null ครับได้ชัว
Date :
2011-05-31 17:12:30
By :
workbythai dot com
No. 2
Guest
function check_null($data){
if($data==""){
return "NULL";
}
}
example: $sql[0] = "update form set jan='".check_null($jan)."' where f_id='$f_id' "