B
B
bychok3002016-10-14 13:39:17
MySQL
bychok300, 2016-10-14 13:39:17

How to insert HTML tags into a table?

this error pops up

mysql>INSERT INTO content (id,template_for_html) VALUES(1,"<div class = "post_header">Заголовок поста</div>" );
ERROR 1064 (42000): 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 'post_header"> </div>")' at line 1
до закрывающего дива куча вопросиков, типо не распознал utf
mysql> status
--------------
mysql Ver 14.14 Distrib 5.7.15, for Linux (x86_64) using EditLine wrapper

Connection id: 4
Current database: test
Current user: [email protected]
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.15-0ubuntu0.16.04.1 (Ubuntu)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/run/mysqld/mysqld.sock
Uptime: 2 hours 13 min 38 sec

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kornachev, 2016-10-14
@zelan

Replace double quotes within a string with single
quotes or escape double quotes within a string

"<div class = \"post_header\">Заголовок поста</div>"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question