 |
รบกวนช่วยดู error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group='1',time=''' at line 1 ทีค่ะ |
|
 |
|
|
 |
 |
|
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 'group='1',time=''' at line 1
รับค่ามาจากหน้าform ให้ส่งมาหน้านี้ค่ะ
Code (PHP)
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
$tblname = "dayOfAtonement";
mysql_connect($hostname, $user, $password) or die("ติดต่อฐานข้อมูลไม่ได้");
mysql_query("SET NAMES UTF8");
mysql_select_db($dbname) or die("เลือกฐานข้อมูลไม่ได้");
$dateAdd = $_POST['dateAdd'];
$departmentId = $_POST['departmentId'];
$notics = $_POST['notics'];
$year = $_POST['year'];
$term = $_POST['term'];
$group = $_POST['group'];
$time = $_POST['time'];
$sql_add = "insert into $tblname set dateAdd='$dateAdd',departmentId='$departmentId', notics='$notics',year='$year',term='$term',group='$group',time='$time' ";
mysql_query($sql_add) or die (mysql_error());
mysql_close();
echo "<meta http-equiv='refresh' content='0;URL=show_s2.php?file=show_s2.php'>";
?>
<body>
</body>
</html>
ไม่ทราบว่าเกิดจากอะไร
Tag : PHP, MySQL
|
|
 |
 |
 |
 |
Date :
2015-01-24 15:40:03 |
By :
ipchully |
View :
934 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
การ INSERT มันจะทำในรูปแบบนี้ครับ
Code (SQL)
INSERT INTO table(field_name, field_name, field_name, ) VALUES ('value', 'value', 'value') ;
ถ้าการ Update ก็จะเป็น
Code (SQL)
UPDATE table SET field_name='', field_name='', field_name='' WHERE field_name='value' ;
ผมว่ามันง่ายดี
|
ประวัติการแก้ไข 2015-01-24 15:46:49 2015-01-24 15:48:32 2015-01-24 15:52:21
 |
 |
 |
 |
Date :
2015-01-24 15:46:22 |
By :
yamcrocodile |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณพี่ๆทุกคนค่ะ น่าจะมีปัญหาเกี่ยวกับการสงวน เพราะข้างในมันแจ้ง The column name 'group' is a MySQL reserved keyword.
ตอนนี้แก้ไขได้แล้วค่ะ ขอบคุณทุกคนมากๆค่ะ
|
 |
 |
 |
 |
Date :
2015-01-24 16:22:32 |
By :
ipchully |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|