<?php
require('connect.php');
mysql_select_db($dbname)or die("Can't choose database ");
$sql3="UPDATE contact SET READ = 'readed' WHERE ID_CON ='$id'";
$result3=mysql_db_query($dbname,$sql3)or die (mysql_error());
$sql = "SELECT * FROM contact where ID_CON=$id";
$result = mysql_query($sql)or die (mysql_error());
$rs=mysql_fetch_array($result);
$id=$rs['ID_CON'];
$title=$rs['TITLE_CON'];
$detail=$rs['DETAIL_CON'];
$date=$rs['DATE_CON'];
$id_user=$rs['ID_USER'];
$read=$rs['READ'];
$sql2="select * from customer where ID_USER='$id_user'";
$result2=mysql_db_query($dbname,$sql2);
$rs2=mysql_fetch_array($result2);
$name=$rs2[NAME_USER];
$user=$rs2[NAME];
if($result){
echo "ชื่อผู้ติดต่อ : ".$name."<br>";
echo "วันที่ : ".$date."<br>";
echo "หัวข้อ : ".$title."////".$read."<br>";
echo "เรื่อง <hr>";
echo $detail;
}
else{echo"เปิดไม่ได้";}
?>
//โค้ดในหน้านี้ของผม
แสดงผลออกมาอย่างนี้ครับ
Code
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 'READ = 'readed' WHERE ID_CON ='3'' at line 1