php - WHERE DateInterval could not be converted to string -
In my database, I got it in the form of day int I have $ diff < / Strong> is the date time.
$ diff- & gt; Format ("% d"); Choose from * smt where day = $ diff
and whenever I use the first format, it still gives me:
Catchable fatal error: The object of the class date object can not be changed in the string ...
Thanks for your reply, I hope I'm not stupid Missing.
$ diff
is an object and is thus interpolated as a string Or can not be concerted because it is not representative of the string that I believe you are trying to interrupt from the date of the result.
Try:
"Select * to smt WHERE day =". $ Diff-> Format ('p');
This inquiry should be secured with SQL injection which is $ diff
always provides a dateInternewall object, although you can use paramellaracted queries with MySQL or PDO should do. / P>
Comments
Post a Comment