ช่วยดูโค้ดให้หน่วยค่ะมันเกี่ยวกับerror อันนี้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 '' at line 1
อันนี้โค้ดที่เขียนค่ะ มันแสดงerror แบบนี้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 '' at line 1
<?
$host="localhost";
$user_name="root";
$pass_word="root";
$db="project";
mysql_connect( $host,$user_name,$pass_word) or die ("ติดต่อไม่ได้ ");
mysql_select_db($db) or die("ติดต่อได้");
$id=$_POST["id"];
$sql="SELECT * FROM `order`"
." INNER JOIN member ON `order`.member_id=member.id"
." WHERE `order`.id=$id";
$re=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($re);
$sql1="SELECT *,order_detail.id as id FROM order_detail"
." INNER JOIN product ON order_detail.product_id=product.id"
." WHERE order_detail.id_order=$id"
." ORDER BY order_detail.id";
$re2=mysql_query($sql1)or die(mysql_error());
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ระบบสมัครสมาชิก</title>
<style type="text/css">
<!--
body,td,th {
color: #99FFCC;
}
.style15 {font-size: larger;
color: #663333;
}
.style18 {
color: #663333;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style19 {font-family: Geneva, Arial, Helvetica, sans-serif}
.style21 {color: #663333}
.style23 {color: #663333; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
.style25 {
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #660033;
font-weight: bold;
}
.style26 {font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
.style29 {color: #FFFFFF}
.style30 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; }
-->
</style></head>
<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1022" height="161" valign="top"><div align="center"><img src="picture/headadmin.jpg" width="1000" height="200" border="0" usemap="#Map5"></div></td>
</tr>
</table>
<div align="center"></div>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1000" height="800" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#99FFFF">
<!--DWLayoutTable-->
<tr>
<td width="1000" height="471" valign="top"><table width="1000" border="0">
<tr>
<td width="272" valign="top" bgcolor="#99CCFF"><table width="254" height="182" border="0" align="center">
<tr>
<td bgcolor="#0099FF"><div align="center"><span class="style23">รายการ</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_mem.php">สมาชิก</a></span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_product.php">สินค้า </a> <br>
- <a href="add_product.php">เพิ่มสินค้า</a><br>
</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_dis.php">ผู้จำหน่าย</a><br>
<a href="add_dis.php"> - เพิ่มผู้จำหน่าย</a><br>
</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"><span class="style19"></span> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_show_order.php">รายการสั่งซื้อสมาชิก</a><br>
<span class="style19"></span> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> รายการสั่งซื้อกับผู้จำหน่าย</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> รายการส่งสินค้าสมาชิก<br>
<span class="style19"> <font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font> </span>รายการส่งสินค้าของผู้จำหน่าย </span></div></td>
</tr>
<tr>
<td><div align="center"><span class="style25"><a href="logout.php"><span class="style21"><span class="style19"></span></span></a></span></div></td>
</tr>
</table> </td>
<td width="718" colspan="2" valign="top" bgcolor="#99CCFF"><p align="center" class="style26"> </p>
<div align="center">
<center>
<h2 class="style23 style29">รายละเอียดการสั่งซื้อ</h2>
</center>
<div align="center" class="style29">
<h3 align="center" class="style26">รายละเอียดการสั่งซื้อของคุณ
<?=$row["username"]?>
ในวันที่
<?=$row["date"]?>
</h3>
<table width="60%" border="1" align="center" cellpadding="5" cellspacing="1" bordercolor="#000000" >
<tr>
<th class="style30">รหัส</th>
<th class="style30">ชื่อสินค้า</th>
<th class="style30">ราคา</th>
<th class="style30">จำนวน</th>
<th class="style30">ราคาส่ง</th>
<th class="style30">รวม</th>
</tr>
<?
$sum=0;
while($row2=mysql_fetch_array($re2)){
$mul=$row2["price2"]*$row2["amount1"]+$row2["price3"];
$sum+=$mul;
?>
<tr>
<td align="center" class="style19">
<span class="style29">
<?=$row2["id"]?>
</span> </td>
<td class="style19">
<span class="style29">
<?=$row2["name"]?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($row2["price2"])?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=$row2["amount1"]?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($row2["price3"])?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($mul)?>
</span> </td>
<? } ?>
<tr>
<td colspan="5" align="right" class="style30">รวมทั้งสิ้น</td>
<td align="right" class="style19"><span class="style29"><b>
<?=number_format($sum)?>
</b></span></td>
</tr>
</table>
</div>
</div>
<p align="center" class="style23"><span class="style29"><a href="admin_show_order.php">แสดงรายการสั่งซื้อ</a></span></p>
<p align="center" class="style18"> </p>
<p align="center" class="style18"><br>
</p>
</tr>
<tr bgcolor="#0099FF">
<td colspan="3"><div align="center"><span class="style15">RUNGARUN PANSEESUK</span></div></td>
</tr>
</table>
้</td>
</tr>
</table></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="170,3,251,34" href="#">
</map>
<map name="Map2">
<area shape="rect" coords="114,169,205,196" href="index.php">
</map>
<map name="Map3">
<area shape="rect" coords="101,167,191,197" href="admin_mem.php">
<area shape="rect" coords="237,168,313,196" href="admin_product.php">
</map>
<map name="Map4">
<area shape="rect" coords="808,172,937,196" href="logout.php">
<area shape="rect" coords="581,157,585,158" href="#">
<area shape="rect" coords="163,172,228,197" href="admin_product.php">
<area shape="rect" coords="52,173,122,195" href="admin_mem.php">
</map>
<map name="Map5">
<area shape="rect" coords="34,171,116,197" href="admin_mem.php">
<area shape="rect" coords="162,166,226,197" href="admin_product.php">
<area shape="rect" coords="809,175,971,199" href="logout.php">
<area shape="rect" coords="268,166,383,198" href="admin_dis.php">
<area shape="rect" coords="413,165,559,196" href="admin_show_order.php">
</map>
</body>
</html>Tag : PHP, MySQL, HTML/CSS, JavaScript
Date :
2011-12-23 20:22:25
By :
friend
View :
805
Reply :
3
ช่วยดูให้นิดนะค่ะ มันเป็นโปรเจ็คจบค่ะ
Date :
2011-12-23 20:41:40
By :
friend
MySQL server version line 1
เปลี่ยน
<? เป็น <?php ดูนะครับ
Date :
2011-12-23 20:48:59
By :
yogolas
Code (PHP)
<?
$host="localhost";
$user_name="root";
$pass_word="root";
$db="project";
mysql_connect( $host,$user_name,$pass_word) or die ("ติดต่อไม่ได้ ");
mysql_select_db($db) or die("ติดต่อได้");
$id=$_POST["id"];
$sql="SELECT * FROM `order`"
." INNER JOIN member ON `order`.member_id=member.id"
." WHERE `order`.id=$id";
$re=mysql_query($sql)or die(mysql_error());
$row=mysql_fetch_array($re);
$sql1="SELECT *,order_detail.id as id FROM order_detail"
." INNER JOIN product ON order_detail.product_id=product.id"
." WHERE order_detail.id_order=$id"
." ORDER BY order_detail.id";
$re2=mysql_query($sql1)or die(mysql_error());
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ระบบสมัครสมาชิก</title>
<style type="text/css">
<!--
body,td,th {
color: #99FFCC;
}
.style15 {font-size: larger;
color: #663333;
}
.style18 {
color: #663333;
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style19 {font-family: Geneva, Arial, Helvetica, sans-serif}
.style21 {color: #663333}
.style23 {color: #663333; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
.style25 {
font-family: Geneva, Arial, Helvetica, sans-serif;
color: #660033;
font-weight: bold;
}
.style26 {font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
.style29 {color: #FFFFFF}
.style30 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; }
-->
</style></head>
<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1022" height="161" valign="top"><div align="center"><img src="picture/headadmin.jpg" width="1000" height="200" border="0" usemap="#Map5"></div></td>
</tr>
</table>
<div align="center"></div>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1000" height="800" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#99FFFF">
<!--DWLayoutTable-->
<tr>
<td width="1000" height="471" valign="top"><table width="1000" border="0">
<tr>
<td width="272" valign="top" bgcolor="#99CCFF"><table width="254" height="182" border="0" align="center">
<tr>
<td bgcolor="#0099FF"><div align="center"><span class="style23">รายการ</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_mem.php">สมาชิก</a></span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_product.php">สินค้า </a> <br>
- <a href="add_product.php">เพิ่มสินค้า</a><br>
</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_dis.php">ผู้จำหน่าย</a><br>
<a href="add_dis.php"> - เพิ่มผู้จำหน่าย</a><br>
</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"><span class="style19"></span> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> <a href="admin_show_order.php">รายการสั่งซื้อสมาชิก</a><br>
<span class="style19"></span> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> รายการสั่งซื้อกับผู้จำหน่าย</span></div></td>
</tr>
<tr>
<td><div align="left"><span class="style21"> <span class="style19"><font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font></span> รายการส่งสินค้าสมาชิก<br>
<span class="style19"> <font size="2"><img src="images/b-hana3-e.gif" width="13" height="14"></font> </span>รายการส่งสินค้าของผู้จำหน่าย </span></div></td>
</tr>
<tr>
<td><div align="center"><span class="style25"><a href="logout.php"><span class="style21"><span class="style19"></span></span></a></span></div></td>
</tr>
</table> </td>
<td width="718" colspan="2" valign="top" bgcolor="#99CCFF"><p align="center" class="style26"> </p>
<div align="center">
<center>
<h2 class="style23 style29">รายละเอียดการสั่งซื้อ</h2>
</center>
<div align="center" class="style29">
<h3 align="center" class="style26">รายละเอียดการสั่งซื้อของคุณ
<?=$row["username"]?>
ในวันที่
<?=$row["date"]?>
</h3>
<table width="60%" border="1" align="center" cellpadding="5" cellspacing="1" bordercolor="#000000" >
<tr>
<th class="style30">รหัส</th>
<th class="style30">ชื่อสินค้า</th>
<th class="style30">ราคา</th>
<th class="style30">จำนวน</th>
<th class="style30">ราคาส่ง</th>
<th class="style30">รวม</th>
</tr>
<?
$sum=0;
while($row2=mysql_fetch_array($re2)){
$mul=$row2["price2"]*$row2["amount1"]+$row2["price3"];
$sum+=$mul;
?>
<tr>
<td align="center" class="style19">
<span class="style29">
<?=$row2["id"]?>
</span> </td>
<td class="style19">
<span class="style29">
<?=$row2["name"]?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($row2["price2"])?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=$row2["amount1"]?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($row2["price3"])?>
</span> </td>
<td align="right" class="style19">
<span class="style29">
<?=number_format($mul)?>
</span> </td>
<? } ?>
<tr>
<td colspan="5" align="right" class="style30">รวมทั้งสิ้น</td>
<td align="right" class="style19"><span class="style29"><b>
<?=number_format($sum)?>
</b></span></td>
</tr>
</table>
</div>
</div>
<p align="center" class="style23"><span class="style29"><a href="admin_show_order.php">แสดงรายการสั่งซื้อ</a></span></p>
<p align="center" class="style18"> </p>
<p align="center" class="style18"><br>
</p>
</tr>
<tr bgcolor="#0099FF">
<td colspan="3"><div align="center"><span class="style15">RUNGARUN PANSEESUK</span></div></td>
</tr>
</table>
้</td>
</tr>
</table></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="170,3,251,34" href="#">
</map>
<map name="Map2">
<area shape="rect" coords="114,169,205,196" href="index.php">
</map>
<map name="Map3">
<area shape="rect" coords="101,167,191,197" href="admin_mem.php">
<area shape="rect" coords="237,168,313,196" href="admin_product.php">
</map>
<map name="Map4">
<area shape="rect" coords="808,172,937,196" href="logout.php">
<area shape="rect" coords="581,157,585,158" href="#">
<area shape="rect" coords="163,172,228,197" href="admin_product.php">
<area shape="rect" coords="52,173,122,195" href="admin_mem.php">
</map>
<map name="Map5">
<area shape="rect" coords="34,171,116,197" href="admin_mem.php">
<area shape="rect" coords="162,166,226,197" href="admin_product.php">
<area shape="rect" coords="809,175,971,199" href="logout.php">
<area shape="rect" coords="268,166,383,198" href="admin_dis.php">
<area shape="rect" coords="413,165,559,196" href="admin_show_order.php">
</map>
</body>
</html>
Date :
2011-12-24 00:05:07
By :
pokultra
Load balance : Server 05