ช่วยดูโค้ดให้ผมหน่อยคับ มันเออเร่อ ผมยัง งงๆอยู่ #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version...
Quote: #1064 - 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 '$sql = "UPDATE member SET bs_id='$bs_id', bs_company='$bs_compa
Code (PHP)
<? session_start(); ?>
<!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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #CCCAAA;
}
.style2 {
font-size: 14px;
font-family: Arial, Helvetica, sans-serif;
}
.style3 {font-size: 12px}
-->
</style></head>
<?php
session_start(); //เปิด session
$ses_admin1id =$_SESSION[ses_admin1id]; //สร้าง session สำหรับเก็บค่า ID
$ses_admin1usn = $_SESSION[ses_admin1usn]; //สร้าง session สำหรับเก็บค่า username
//ตรวจสอบว่าทำการ Login เข้าสู่ระบบมารึยัง
if($ses_admin1id <> session_id() or $ses_admin1usn==""){
echo "โปรดทำการเข้าสู่ระบบ<br />";
}
//ตรวจสอบสถานะว่าใช่ admin รึเปล่า ถ้าไม่ใช่ให้หยุดอยู่แค่นี้
if($_SESSION[ses_status] != "admin1") {
echo "สำหรับ Admin เท่านั้น";
echo "<meta http-equiv='refresh' content=2;url='admin_login.php'>";
exit();
}
?>
<body><div id="body" align="center">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" bgcolor="#FFFFFF"><img src="imgs/banner.jpg" width="1024" height="50" /><br />
<img src="imgs/admin_checklogin.php" width="1024" height="5" /></td>
</tr>
<tr valign="top">
<td width="125" bgcolor="#FFFFFF"><a href="admin1_seeall_user.php"><img src="imgs/menu_admin1.jpg" width="125" height="30" border="0" align="top" /></a><br />
<a href="admin1_manage.php"><img src="imgs/menu_admin2.jpg" width="125" height="30" border="0" /></a><br />
<a href="admin1_add_user.php"><img src="imgs/menu_admin3.jpg" width="125" height="30" border="0" /></a><br />
<a href="admin1_report.php"><img src="imgs/menu_admin4.jpg" width="125" height="30" border="0" /></a><br />
<a href="admin1_search_user.php"><img src="imgs/menu_admin5.jpg" width="125" height="30" border="0" /></a><br />
<a href="admin_login.php"><img src="imgs/menu_logout.jpg" width="125" height="30" border="0" /></a></a><br /></td>
<td width="899" colspan="3" bgcolor="#FFFFFF"><p> </p>
<p align="center" class="style2">แก้ไขข้อมูลลูกค้า</p>
<p align="center"><img src="imgs/2.png" width="48" height="48" /></p>
<p align="center">
<?
// Hotel and casino details from casino update form
$bs_company = $_POST['bs_company'];
$bs_typeb = $_POST['bs_typeb'];
$bs_sex = $_POST['bs_sex'];
$bs_name = $_POST['bs_name'];
$bs_surname = $_POST['bs_surname'];
$bs_address = $_POST['bs_address'];
$bs_address2 = $_POST['bs_address2'];
$bs_city = $_POST['bs_city'];
$bs_zipcode = $_POST['bs_zipcode'];
$bs_tel = $_POST['bs_tel'];
$bs_email = $_POST['bs_email'];
$bs_pfrom = $_POST['bs_pfrom'];
// Games from the casino update form
$pro_sn = $_POST['pro_sn'];
$pro_name = $_POST['pro_name'];
// Resaurant in the casino update form
$bill_date = $_POST['bill_date'];
// connect to mysql
$conn = mysql_connect("localhost", "root", "1234")
or die("ERR: Connection");
// connect to database
$db = mysql_select_db("bs", $conn)
or die("ERR: Database");
mysql_query("set character_set_results = utf8") or die(mysql_error());
mysql_query("set names utf8") or die(mysql_error());
$sql = "UPDATE member SET bs_id='$bs_id', bs_company='$bs_company', bs_typeb='$bs_typeb', bs_sex='$bs_sex', bs_name='$bs_name', bs_surname='$bs_surname', bs_address='$bs_address', bs_address2='$bs_address2', bs_city='$bs_city', bs_zipcode='$bs_zipcode',bs_tel='$bs_tel',bs_email='$bs_email',bs_pfrom='$bs_pfrom'
WHERE bs_id='$bs_id' " ;
// execute query
$exec = mysql_query($sql, $conn)or die(mysql_error());
$sql_1 = "UPDATE bill SET bill_id='$bill_id', bill_date='$bill_date', bs_id='$bs_id', pro_id='$pro_id' WHERE bill_id='$bill_id'";
// execute query
$exec = mysql_query($sql_1, $conn)or die(mysql_error());
$sql_2 = "UPDATE program SET (pro_id='$pro_id', pro_sn='$pro_sn', pro_name='$pro_name' WHERE pro_id='$pro_id'";
// execute query
$exec = mysql_query($sql_2, $conn)or die(mysql_error());
$insert = mysql_query($sql);
if($insert)
{
echo ("สำเร็จ");
}
else
{
echo ("ไม่สำเร็จ");
//mysql_error($sql);
}
?>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
</table>
</div>
<meta http-equiv="refresh" content="2;url=admin1_manage.php">
</body>
</html>
Tag : PHP
Date :
2012-12-26 10:04:15
By :
th3tee
View :
819
Reply :
1
Load balance : Server 04