I searched a lot and cannot find my answer. I'm trying to include 2 variable in my like statement to match a date that wasn't formatted correctly in a database I'm working on.
I need to:
Select count(*) as ABC
from database
where active like '1'
and agent = '$Employeestringid'
AND time LIKE '%$FilterMonth_%_$queryyear'"
The part that is currently not working is: '%$FilterMonth_%_$queryyear'
I need it to work and match a date formatted like: '9:10:31 PM Fri, May 20th 2016'
by only capturing MONTH and YEAR.
When interpolating your variables in the string, PHP reads the _
as part of the variable name.
You need to use {}
to prevent this behavior:
$query = "Select count(*) as ABC
from database
where active like '1'
and agent = '$Employeestringid'
AND time LIKE '%{$FilterMonth}_%_{$queryyear}'";
删除下划线
'%$FilterMonth%$queryyear'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.