ช่วยแก้โค้ดหน่อยนะครับ
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา ช่วยแก้โค้ดหน่อยนะครับ
ช่วยแก้โค้ดหน่อยนะครับ
Copy
มันแสดงว่า
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `day`=, `Month`=, `year`=, str_time=, end_time=, `meeting room`=, detail_room_m' at line 1
<?php require_once('Connections/ldo.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE all_data_ldo SET divistion=%s, story=%s, `day`=%s, `Month`=%s, `year`=%s, str_time=%s, end_time=%s, `meeting room`=%s, detail_room_meeting=%s, Tools=%s, manage_table=%s, applicant=%s, job1=%s, Facilitator=%s, job2=%s, status=%s WHERE `number`=%s",
GetSQLValueString($_POST['divistion'], "text"),
GetSQLValueString($_POST['story'], "undefined"),
GetSQLValueString($_POST['day'], "undefined"),
GetSQLValueString($_POST['Month'], "undefined"),
GetSQLValueString($_POST['year'], "undefined"),
GetSQLValueString($_POST['str_time'], "undefined"),
GetSQLValueString($_POST['end_time'], "undefined"),
GetSQLValueString($_POST['meeting_room'], "undefined"),
GetSQLValueString($_POST['detail_room_meeting'], "undefined"),
GetSQLValueString($_POST['Tools'], "undefined"),
GetSQLValueString($_POST['manage_table'], "undefined"),
GetSQLValueString($_POST['applicant'], "undefined"),
GetSQLValueString($_POST['job1'], "undefined"),
GetSQLValueString($_POST['Facilitator'], "text"),
GetSQLValueString($_POST['job2'], "text"),
GetSQLValueString($_POST['status'], "text"),
GetSQLValueString($_POST['number'], "int"));
mysql_select_db($database_ldo, $ldo);
$Result1 = mysql_query($updateSQL, $ldo) or die(mysql_error());
$updateGoTo = "Show_all_up.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['number'])) {
$colname_Recordset1 = $_GET['number'];
}
mysql_select_db($database_ldo, $ldo);
$query_Recordset1 = sprintf("SELECT * FROM all_data_ldo WHERE `number` = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $ldo) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_ldo, $ldo);
$query_Recordset2 = "SELECT * FROM divistion";
$Recordset2 = mysql_query($query_Recordset2, $ldo) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
mysql_select_db($database_ldo, $ldo);
$query_Recordset3 = "SELECT * FROM status";
$Recordset3 = mysql_query($query_Recordset3, $ldo) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);
?>
<!doctype html>
<html>
<head>
<meta charset="windows-874">
<title>Untitled Document</title>
</head>
<body>
<table width="1024" border="1" align="center">
<tr>
<td><p> </p>
<p> </p>
<p> </p>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Number:</td>
<td><?php echo $row_Recordset1['number']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Divistion:</td>
<td><select name="divistion">
<?php
do {
?>
<option value="<?php echo $row_Recordset2['name_divistion']?>" <?php if (!(strcmp($row_Recordset2['name_divistion'], $row_Recordset1['divistion']))) {echo "SELECTED";} ?>><?php echo $row_Recordset2['name_divistion']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
?>
</select></td>
<tr>
<tr valign="baseline">
<td nowrap align="right">Story:</td>
<td><?php echo $row_Recordset1['story']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Day:</td>
<td><?php echo $row_Recordset1['day']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Month:</td>
<td><?php echo $row_Recordset1['Month']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Year:</td>
<td><?php echo $row_Recordset1['year']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Str_time:</td>
<td><?php echo $row_Recordset1['str_time']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">End_time:</td>
<td><?php echo $row_Recordset1['end_time']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Meeting room:</td>
<td><?php echo $row_Recordset1['meeting room']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Detail_room_meeting:</td>
<td><?php echo $row_Recordset1['detail_room_meeting']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Tools:</td>
<td><?php echo $row_Recordset1['Tools']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Manage_table:</td>
<td><?php echo $row_Recordset1['manage_table']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Applicant:</td>
<td><?php echo $row_Recordset1['applicant']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Job1:</td>
<td><?php echo $row_Recordset1['job1']; ?></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Facilitator:</td>
<td><input type="text" name="Facilitator" value="<?php echo $row_Recordset1['Facilitator']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Job2:</td>
<td><input type="text" name="job2" value="<?php echo $row_Recordset1['job2']; ?>" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Status:</td>
<td><select name="status">
<?php
do {
?>
<option value="<?php echo $row_Recordset3['statuss']?>" <?php if (!(strcmp($row_Recordset3['statuss'], $row_Recordset1['status']))) {echo "SELECTED";} ?>><?php echo $row_Recordset3['statuss']?></option>
<?php
} while ($row_Recordset3 = mysql_fetch_assoc($Recordset3));
?>
</select></td>
<tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update record"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="number" value="<?php echo $row_Recordset1['number']; ?>">
</form>
<p> </p></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
mysql_free_result($Recordset3);
?>
คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ