Home > Backend Development > PHP Tutorial > 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
Release: 2016-08-18 09:15:29
Original
1485 people have browsed it

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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

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

This request will of course display all the data

No reason, it’s just like this

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template