O
O
Optimus2014-08-09 15:02:54
PHP
Optimus, 2014-08-09 15:02:54

Apostrophes in the text interfere with sql, what should I do?

The code in the base is:

<img alt='подпись' title='подпись' border="0" src="http://site.ru/kartinka.png"></p>

I take it out, replace site.ru with site2.ru and try to write it back and...
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 'signature' at line 1 I
guess he doesn't like apostrophes in the string and they break the sql write query. What to do, how can they be ignored?
The request itself:
mysql_query(" UPDATE `Message23` SET `Text`='$new_text' WHERE `Message_ID`='$id' ") or die(mysql_error());

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Entelis, 2014-08-09
@DmitriyEntelis

if quick and easy - mysqli_real_escape_string

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question