K
K
kodwi2014-12-09 22:49:10
PHP
kodwi, 2014-12-09 22:49:10

What is the problem with SQL query to MySQL in PHP?

Query after escaping:

SELECT * FROM test WHERE field1=\'test321\' AND field2=\'test123\';

But after query() errorCode == 42000. Where is the cant with the syntax?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2014-12-10
@kodwi

The cant is in the user, because he shields not what is needed, and not what is needed.
Read about mysql_real_escape_string()and fix your code.

F
FanatPHP, 2014-12-09
@FanatPHP

The problem is with the user who escaped this request.
To solve the problem, you need to send the user to learn the rules for compiling requests.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question