MySQL Forums
Forum List  »  Newbie

Re: How to query for rec's WHERE >= $start_date ?
Posted by: Fran Lee
Date: December 29, 2017 04:39PM

Here is the answer...

$dt="2017/12/01"; // note no back ticks inside the quotes
$dt = mysqli_real_escape_string($conn,$dt);
$dt = "'".$dt."'"; // now add the back ticks before you use the string in a query



In other words pass the date as a string without the back ticks and then...
... once you have run it through the mysqli_real_escape_string function
... add the back ticks so it will work in the query

Turns out mysqli_real_escape_string strips out the back ticks... that is why it seems you have to do it this way.

This seemed to work for me but if I am incorrect, please let me know.

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
Re: How to query for rec's WHERE >= $start_date ?
December 29, 2017 04:39PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.