Home  >  Article  >  Backend Development  >  Why didn't I query it when I used fuzzy query? It displayed all the data by itself?

Why didn't I query it when I used fuzzy query? It displayed all the data by itself?

WBOY
WBOYOriginal
2016-08-18 09:15:291467browse

I haven’t submitted the query conditions yet. Every time I open this page, all the data in the user table is displayed. If fuzzy query is not used, this situation will not happen. Why is this?

<code>$sql="SELECT * FROM user WHERE name like '%{$name}%'";</code>

Reply content:

I haven’t submitted the query conditions yet. Every time I open this page, all the data in the user table is displayed. If fuzzy query is not used, this situation will not happen. Why is this?

<code>$sql="SELECT * FROM user WHERE name like '%{$name}%'";</code>

If no query conditions are submitted
Then the sql is like this

<code>SELECT * FROM user WHERE name like '%%';</code>

This request will of course display all the data

No reason, it’s just like this

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn