Home >Backend Development >PHP Tutorial >How to solve the problem that the where condition in the query database has fields, but the query is empty

How to solve the problem that the where condition in the query database has fields, but the query is empty

一个新手
一个新手Original
2017-09-30 12:38:003861browse


This is a problem encountered in the ThinkPHP framework

The reason for this is:
There is a problem when writing the where statement:

eg: select datatype from t_loop where address = 2/2/41;

框架中where('address='.$address)

This query is empty,

select datatype from t_loop where address = '2/2/41';

框架中where(['address'=>$address])

This query has a value

The above is the detailed content of How to solve the problem that the where condition in the query database has fields, but the query is empty. For more information, please follow other related articles on the PHP Chinese website!

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