10/10/2018, 11:39
Lỗi Này Sửa Sao đây giúp Mình với....... Hu hu
Khi lưu định dạng html gồm các tap xuống một trường text trong mysql Mình gặp phải lỗi cú pháp của mysql
1) Đoạn code query trong mysql như sau:
INSERT INTO `hai_baiviet`(`mabai`, `tenbai`, `mo_ta`, `duong_dan`, `ngay_dang`, `idloaitt`, `tieu_diem`,`user`) VALUES (','bài viết 1','<p><span style="font-family: 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>','cac_bai_viet/bai1sdsd','18/3/2012',5,0,'administrator')
2) Khi thực hiện lệnh thì My SQL báo Lỗi như sau:
#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 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>','cac_bai_viet/' at line 1
Mình biết là do cái chỗ '<p><span style="font-family: 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>'
Nó Sai cú pháp của My Sql Vì có dấu nháy ' ' trong cụm 'Times New Roman'
àh Mình dùng CKeditor
Anh/ chị ai biết giúp em với. hic hic
1) Đoạn code query trong mysql như sau:
INSERT INTO `hai_baiviet`(`mabai`, `tenbai`, `mo_ta`, `duong_dan`, `ngay_dang`, `idloaitt`, `tieu_diem`,`user`) VALUES (','bài viết 1','<p><span style="font-family: 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>','cac_bai_viet/bai1sdsd','18/3/2012',5,0,'administrator')
2) Khi thực hiện lệnh thì My SQL báo Lỗi như sau:
#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 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>','cac_bai_viet/' at line 1
Mình biết là do cái chỗ '<p><span style="font-family: 'Times New Roman';">Khi thời tiết chớm giao mùa</span></p>'
Nó Sai cú pháp của My Sql Vì có dấu nháy ' ' trong cụm 'Times New Roman'
àh Mình dùng CKeditor
Anh/ chị ai biết giúp em với. hic hic
Bài liên quan
http://php.net/manual/en/function.addslashes.php
Xong lúc show bài replace ngược lại. Để đảm bảo luôn thỏa mãn những mã html đó đc dịch dưới browser
Bạn nên insert từng field, bạn sẽ biết nên làm gì.