 |
บันทึกข้อมูล forums นี้ไม่ผ่านครับ ช่วยดูให้หน่อยครับ |
|
 |
|
|
 |
 |
|
table forums
frm_id int(10) UNSIGNED ไม่ auto_increment
frm_title varchar(255) utf8_general_ci ไม่
frm_name varchar(100) utf8_general_ci ไม่
frm_email varchar(50) utf8_general_ci ไม่
frm_tel varchar(10) utf8_general_ci ไม่
frm_detail text utf8_general_ci ไม่
frm_postip varchar(20) utf8_general_ci ไม่ เก็บ ip
frm_posttime datetime ไม่ เวลาที่โพสกระทู้นี้
view smallint(5) UNSIGNED จำนวนผู้ที่ดูกระทู้นี้
บันทึกข้อมูลแบบนี้ครับ
$sql="INSERT INTO forum_topic VALUES (NULL,'$title,'$name','$email','$tel','$detail','$ip',now(),0,) ";
ผมทำชนิดของฟิลว์ผิดไปรึเปล่าครับ
หรือว่า $sql ผิด
Tag : PHP, MySQL, HTML/CSS
|
|
 |
 |
 |
 |
Date :
2010-10-06 21:57:24 |
By :
kingarcher |
View :
832 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
การ insert ที่ดีควรระบุชื่อฟิวด์ลงไปด้วยน่ะครับ
Go to : SQL INSERT
ส่วนถ้าอยากจะรู้ว่า Error เพราะอะไรให้ใช้
Code (PHP)
mysql_query($strSQL) or die(mysql_error());
|
 |
 |
 |
 |
Date :
2010-10-06 22:05:59 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันฟ้องว่า
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
คืออะไรเหรอครับ
|
 |
 |
 |
 |
Date :
2010-10-06 22:27:14 |
By :
kingarcher |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ้อ ป้อนเลข 0 เข้า ฟิวล์ view ไม่ได้
view smallint(5) UNSIGNED จำนวนผู้ที่ดูกระทู้นี้
$sql="INSERT INTO forum_topic VALUES (NULL,'$title,'$name','$email','$tel','$detail','$ip',now(),0,) ";
ผิดในส่วน view ชนิด smallint
แต่ผมทำตามหนังสือละนะครับ ผิดได้ไงอ่า
|
 |
 |
 |
 |
Date :
2010-10-06 22:36:16 |
By :
kingarcher |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้ละครับ
$sql="INSERT INTO forum_topic VALUES (null,'$subject','$name','$email','$tel','$message',now(),'$ip',0) ";
อันนี้ผิดเพราะ ,
$sql="INSERT INTO forum_topic VALUES (NULL,'$title,'$name','$email','$tel','$detail','$ip',now(),0,) ";
แหะๆ ขอบคุณพี่วินมากนะครับ สำหรับเช็ค Error
จะทำให้ถูกรูปแบบเดี๋ยวนี้แหละครับ
|
 |
 |
 |
 |
Date :
2010-10-06 22:42:44 |
By :
kingarcher |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|