เว็บรันกับ php5.3 ใช้งานได้ปกติ พออัพ php5.6 ตอนกดบันทึกขึ้นหน้าขาวไม่แจ้งerror
code อันที่ 1 ชื่อไฟล์ roombook.php
<?php
session_start();
if(!$_SESSION['Flname'])
header('Location:index.php');
require_once('connection.php');
require_once('function.php');
$c_row=mysql_db_query($dbname,"select * from bookroom where row_id='$row_id' ");
$row=mysql_fetch_array($c_row);
$c_unitlist=unitlist($row['unit_id']);
include('connection.php');
?>
<!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=utf8" />
<title>ระบบปฎิทินการปฏิบัติงานสาธารณสุขจังหวัดหนองคาย ปีงบประมาณ 2559</title>
<script language="JavaScript" src="style/calendar.js"></script>
<script language="javascript">
function chkform()
{
if(document.form1.unit_id.value == 0 && document.form1.unit_out == '')
{
alert("กรุณาระบุหน่วยงานที่รับผิดชอบในการจัดประชุม");
document.form1.unit_id.focus();
return false;
}else
if(document.form1.subject.value == 0)
{
alert("กรุณาระบุเรื่องที่ประชุม");
document.form1.subject.focus();
return false;
}else
if(document.form1.numper.value == 0)
{
alert("กรุณาระบุจำนวนผู้เข้าประชุม");
document.form1.numper.focus();
return false;
}else
if(document.form1.name.value == 0)
{
alert("กรุณาเลือกห้องประชุม");
document.form1.name.focus();
return false;
}else
if(document.form1.datemeet.value == 0)
{
alert("กรุณาเลือกวันใช้ห้อง");
document.form1.datemeet.focus();
return false;
}else
if(document.form1.s_time1.value == 0)
{
alert("กรุณาเลือกเวลาเริ่ม");
document.form1.s_time1.focus();
return false;
}
document.form1.submit();
}
function check_number() {
e_k=event.keyCode
if (((e_k > 57) || (e_k < 47)) && e_k != 46 && e_k != 13) {
event.returnValue = false;
alert(" กรุณาระบุเป็นตัวเลขเท่านั้น");
}
}
</script>
<script>
function newXmlHttp(){
var xmlhttp = false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
xmlhttp = false;
}
}
if(!xmlhttp && document.createElement){
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
</script>
<script language="javascript">
function checkdup(s_time,room_id,datemeet){
var url = "a_chkdup.php?s_time="+s_time+"&room_id="+room_id+"&datemeet="+datemeet ;
xmlhttp = newXmlHttp();
xmlhttp.open("GET", url, false);
xmlhttp.send(null);
document.getElementById('chkdup').innerHTML = xmlhttp.responseText ;
}
</script>
<link href="style/calendar-mos.css" rel="stylesheet" type="text/css">
<link href="style/mystyle.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
a:link {
color: #000000;
text-decoration: none;
font-size:small;
}
a:visited {
color: #333333;
text-decoration: none;
font-size:small;
}
a:hover {
color:#FF6600;
text-decoration: underline;
font-size:small;
}
a:active {
color: #FF0000;
font-size:small;
}
body,td,th {
font-family: tahoma, mS Sans Serif;
font-size: small;
}
#Layer1 {
position:absolute;
left:925px;
top:141px;
width:140px;
height:95px;
z-index:1;
}
body {
background-image: url(new/temp.jpg);
background-color: #FFFFFF;
background-repeat: no-repeat;
}
.style1 {
color: #FFFFFF;
font-weight: bold;
}
.style2 {color: #FFFFFF}
.style3 {color: #339933}
.style4 {color: #3366CC}
</style>
</head>
<body leftmargin="0" topmargin="0">
<table border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#E5E5E5" bgcolor="#FFFFFF">
<tr>
<td>
<table width="1064" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="140" colspan="2" background="img/title2_bg.jpg"><img src="img/logonk.jpg" width="1064" height="140" /></td>
</tr>
<tr>
<td height="22" colspan="2" background="img/tab_brnews_04.gif" bgcolor="#CFE5F3"><span class="style2"><img src="img/icon_comment.gif" width="14" height="12" /> ผู้ใช้งาน :
<?php
if($_SESSION['Flname']) echo $_SESSION['Flname']; else echo 'ผู้ใช้ทั่วไป';
?>
</span></td>
</tr>
<tr>
<td width='10' height="500" valign="top" bgcolor="#F0F8FB" style="border-right:dotted 1px;">
<?php
echo '';
include('menu_left.php');
?> </td>
<td width="1043" align="center" valign="top"><br />
<form action="roombook_save.php" method="post" name="form1" id="form1">
<table width="85%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#A5CEEA">
<tr>
<td height="24"><span class="style1">ลงรายการปฎิทินปฏิบัติงาน /จองห้องประชุม</span></td>
</tr>
<tr><td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>หน่วยงานที่จัด : </strong></div></td>
<td align="left" bgcolor="#F4F9FD"><label>
<input name="unit_type" type="radio" value="1" <? if($row['unit_out']=='') echo ' checked '; ?> onclick="JavaScript:document.getElementById('unit_out').style.display='none'; document.getElementById('unit_id').style.display='';document.getElementById('unit_out').value=''"/>
<span class="style4">หน่วยงานภายใน</span></label>
<label>
<span class="style3">
<input name="unit_type" type="radio" value="2" <? if($row['unit_out']!='') echo ' checked '; ?> onclick="JavaScript:document.getElementById('unit_out').style.display=''; document.getElementById('unit_id').style.display='none';document.getElementById('unit_id').value = '0' " />
หน่วยงานภายนอก</span></label>
<br />
<select name="unit_id" class="fontNormal" id="unit_id" >
<option selected="selected" value="0">--เลือกหน่วยงาน--</option>
<?php
echo $c_unitlist;
?>
</select>
<input name="type" type="hidden" id="type" value="<? if($row_id) echo 'edit'; else echo 'new'; ?>" />
<input name="row_id" type="hidden" id="row_id" value="<?=$row_id?>" />
<input name="unit_out" type="text" class="fontNormal" id="unit_out" value="<?=$row['unit_out']?>" size="50" style="display:none" /></td>
</tr>
<tbody>
<tr>
<td width="19%" bgcolor="#EBF4F9"><div align="right"><strong>เรื่อง : </strong></div></td>
<td width="81%" align="left" bgcolor="#EBF4F9"><input name="subject" type="text" class="fontNormal" id="subject" size="80" value="<?=$row['subject']?>" />
* </td>
</tr>
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>ผู้ร่วมประชุม : </strong></div></td>
<td align="left" bgcolor="#F4F9FD"><input name="perhead" type="text" class="fontNormal" id="perhead" value="<?=$row['perhead']?>" size="50" />
* </td>
</tr>
<tr>
<td bgcolor="#EBF4F9"><div align="right"><strong>จำนวนผู้เข้าประชุม : </strong></div></td>
<td align="left" bgcolor="#EBF4F9"><input name="numper" type="text" class="fontNormal" id="numper" onkeypress="check_number()" value="<?=$row['numper']?>" size="10" />
* </td>
</tr>
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>ห้องที่ใช้ประชุม : </strong></div></td>
<td align="left" bgcolor="#F4F9FD">
<select name="room_id" class="fontNormal" id="room_id" onchange="checkdup(document.getElementById('s_time1').value+':00',this.value,document.getElementById('datemeet').value)">
<option value="0" selected="selected">--เลือกห้องประชุม--</option>
<?php
require_once('connection.php');
$room_sql=mysql_db_query($dbname,"select row_id,name from room");
while($f_room=mysql_fetch_array($room_sql)) {
?>
<option value="<?=$f_room[0]?>" <? if($row['room_id']==$f_room[0]) echo ' selected '; ?> ><?=$f_room[1]?></option>
<?
}
?>
</select>
* <div class="fontBN" id="chkdup"></div></td>
</tr>
<tr>
<td valign="top" bgcolor="#EBF4F9"><div align="right"><strong>ห้องประชุมระบุ : </strong></div></td>
<td align="left" bgcolor="#EBF4F9"><input name="memo" type="text" class="fontNormal" id="memo" value="<?=$row['memo']?>" size="40" /></td>
</tr>
<td bgcolor="#EBF4F9"><div align="right"><strong>วันที่ใช้ห้อง : </strong></div></td>
<td align="left" bgcolor="#EBF4F9"><input name="datemeet" type="text" class="fontNormal" id="datemeet" value="<?php if($row['datemeet']) echo d2thai(substr($row[datemeet],0,10)); ?>" size="10" />
<input type="button" name="Submit" value=" ... " onclick="showCalendar('datemeet','DD-MM-YY')" />
* (เช่น 22-06-2553) </td>
</tr>
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>ช่วงเวลาที่ใช้ : </strong></div></td>
<td align="left" bgcolor="#F4F9FD">เวลา
<select name="s_time1" id="s_time1" onchange="checkdup(this.value+':00',document.getElementById('room_id').value,document.getElementById('datemeet').value)">
<option selected="selected" value="0"> -- </option>
<?php
$xs_time=explode(':',$row['s_time']);
for ($i=6;$i<20;$i++) {
if($i==$xs_time[0]) $sel=" selected "; else $sel="";
if ($i<10) echo "<option value='0$i' ".$sel.">0$i</option>";
else echo "<option value=$i".$sel.">$i</option>";
}
?>
</select>
:
<select name="s_time2" id="s_time2">
<?php
for ($i=0;$i<6;$i++) {
$m=$i*10;
if($m==$xs_time[1]) $sel=" selected "; else $sel="";
if ($m<10) echo "<option value='0$m' ".$sel.">0$m</option>";
else echo "<option value=$m ".$sel.">$m</option>";
}
?>
</select>
น. ถึง
<select name="e_time1" id="e_time1">
<?php
$xe_time=explode(':',$row['e_time']);
for ($i=6;$i<20;$i++) {
if($i==$xe_time[0]) $sel=" selected "; else $sel="";
if ($i<10) echo "<option value='0$i' ".$sel.">0$i</option>";
else echo "<option value=$i".$sel.">$i</option>";
}
?>
</select>
:
<select name="e_time2" id="select2">
<?php
for ($i=0;$i<6;$i++) {
$m=$i*10;
if($m==$xe_time[1]) $sel=" selected "; else $sel="";
if ($m<10) echo "<option value='0$m' ".$sel.">0$m</option>";
else echo "<option value=$m ".$sel.">$m</option>";
}
?>
</select>
น.
</td>
</tr>
<tr>
<td bgcolor="#EBF4F9"><div align="right"><strong>อุปกรณ์ที่ใช้ : </strong></div></td>
<td align="left" valign="top" bgcolor="#EBF4F9">
<?php
$r=1;
$e_sql=mysql_db_query($dbname,"select row_id,name from equip");
while($row_equip=mysql_fetch_array($e_sql)) {
?>
<label>
<input name="equip[]" type="checkbox" id="equive<?=$row_equip[0]?>" value="<?=$row_equip[0]?>" <? if(strpos($row['equip'],$row_equip[0].'|')) echo ' checked '; ?>
/>
<?=$row_equip[1]?>
</label>
<?
if($r++>3) {
echo "<br>";
$r=1;
}
} ?> </td>
</tr>
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>เตรียมอาหาร : </strong></div></td>
<td align="left" valign="top" bgcolor="#F4F9FD">
<?php
$xfood=explode('|',$row['food']); ?>
<input name="food[]" type="checkbox" id="food[]" value="1" <? if($xfood[0]=='1') echo ' checked '; ?> />
อาหารว่างเช้า
<input name="food[]" type="checkbox" id="food[]" value="1" <? if($xfood[1]=='1') echo ' checked '; ?> />
อาหารกลางวัน
<input name="food[]" type="checkbox" id="food[]" value="1" <? if($xfood[2]=='1') echo ' checked '; ?> />
อาหารว่างบ่าย<br /></td>
</tr>
<!-- <tr>
<td valign="top" bgcolor="#EBF4F9"><div align="right"><strong>หมายเหตุ : </strong></div></td>
<td align="left" bgcolor="#EBF4F9"><input name="memo" type="text" class="fontNormal" id="memo" value="<?=$row['memo']?>" size="40" /></td>
</tr> -->
<tr>
<td bgcolor="#F4F9FD"><div align="right"><strong>ชื่อผู้จอง : </strong></div></td>
<td align="left" bgcolor="#F4F9FD"><?=$_SESSION['Flname']?>
<input name="perbook" type="hidden" value="<?=$_SESSION['Flname']?>" />
<input name="b_status" type="hidden" id="b_status" value="0" /></td>
</tr>
<tr>
<td bgcolor="#EBF4F9"> </td>
<td align="left" bgcolor="#EBF4F9"><input name="Button" type="button" class="button" onclick="chkform();" value="จองห้องประชุม" />
<input name="Submit2" type="reset" class="button" value="ยกเลิก" /></td>
</tr>
</tbody>
</table>
</td></tr>
</table>
</form></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
<script>
<? if($row['unit_out']=='') { ?>
document.getElementById('unit_out').style.display='none';
document.getElementById('unit_id').style.display='';
document.getElementById('unit_out').value=''
<? } else { ?>
document.getElementById('unit_out').style.display='';
document.getElementById('unit_id').style.display='none';
document.getElementById('unit_id').value='0';
<? } ?>
</script>
</html>
====================================
code อันที่ 2 ชื่อไฟล์ roombook_save.php
<?php
include("connection.php");
include("function.php");
$x_table='bookroom';
$datereg=date('Y-m-d H:i:s');
$datemeet=d2sql($datemeet);
$from_ip=$_SERVER['REMOTE_ADDR'];
$c_equip='';
for($i=0;$i<count($equip);$i++) {
$c_equip.=$equip[$i].'|';
}
$equip=$c_equip;
$food=$food[0].'|'.$food[1].'|'.$food[2];
$s_time=$s_time1.':'.$s_time2;
$e_time=$e_time1.':'.$e_time2;
if($type=='new') {
//INSERT
$i=0;
$c_f = "INSERT INTO ".$x_table." (row_id";
$v_f=") VALUES ('$row_id";
$r_field = mysql_db_query($dbname,"show fields from ".$x_table);
$r_num=mysql_num_rows($r_field);
while ($f_field = mysql_fetch_array($r_field)) {
if ($i>0) {
$c_f.=",".$f_field[0];
if($i<$r_num-1) {
$v_f.="','";
eval("\$v_f.=str_replace(',','',\$".$f_field[0].");");
}
}
$i++;
}
$c_in=$c_f.$v_f."',now())";
$r_in = mysql_db_query($dbname,$c_in);
//echo $c_in ;
echo "<meta http-equiv='Refresh' content='0;url=roombook_show.php?date=$datemeet'>";
} else {
if($type=='edit') {
//UPDATE
$i=0;
$c_f = "UPDATE ".$x_table." SET ";
$r_field = mysql_db_query($dbname,"show fields from ".$x_table);
$r_num=mysql_num_rows($r_field);
while ($f_field = mysql_fetch_array($r_field)) {
if ($i>0) {
if($i<$r_num-1) {
if($i>1) { $c_f.=","; }
$c_f.=$f_field[0]."='";
eval("\$c_f.=str_replace(',','',\$".$f_field[0].");");
$c_f.="'";
}
}
$i++;
}
$c_in=$c_f.$v_f.",d_update=now() WHERE row_id='$row_id' ";
//echo $c_in."<BR>";
$r_in = mysql_db_query($dbname,$c_in) or die ("can not connect to table specified");
if($b_status) {
$s_month=substr($datemeet,6,2);
$s_year=substr($datemeet,0,4);
echo "<meta http-equiv='Refresh' content='0;url=roombook_report.php?s_month=$month&s_year=$s_year'>";
} else {
echo "<meta http-equiv='Refresh' content='0;url=roombook_show.php?date=$datemeet'>";
}
}
}
if($type=='del') {
mysql_db_query($dbname,"DELETE FROM ".$x_table." WHERE row_id='$row_id' ");
}
if($type=='cancel') {
mysql_db_query($dbname,"UPDATE ".$x_table." SET b_status='9' WHERE row_id='$row_id' ");
echo "<meta http-equiv='Refresh' content='0;url=roombook_report.php'>";
}
if($type=='uproom') {
mysql_db_query($dbname,"UPDATE ".$x_table." SET b_status='$b_status',cause='$cause' WHERE row_id='$row_id' ");
echo "<meta http-equiv='Refresh' content='0;url=roombook_admin.php'>";
}
?>
======================================
ปัญหาคือ กดปุ่ม "จองห้องประชุม" แล้วขึ้นหน้าขาวครับ และไม่บันทึกข้อมูลให้Tag : PHP, MySQL
Date :
2016-08-03 16:13:22
By :
pphat21
View :
1377
Reply :
4
เอาใปใส่ไว้ใน code แล้ว run ดู error อีกที เอาไว้ใต้ session ก็ได้
error_reporting(E_ALL);
Date :
2016-08-03 16:18:04
By :
thesin18598
mysql_db_query -> mysqli_db_query ดูครับ
Date :
2016-08-04 09:01:47
By :
compiak
Load balance : Server 01