PHP Mysql query is empty -


this question exact duplicate of:

i have grabbed variables page1 page page2

page2.php

 $date=mysqli_real_escape_string($dbc, $_get['date']);    $date1=mysqli_real_escape_string($dbc, $_get['date1']); 

i display them :

echo $date.'<br/>'; //2016-05-20 echo $date1.'<br/>';//2016-05-25 

when try use them in query got , empty result:

$result=mysqli_query($dbc,"select  id_eob eob_posting  eob_date >='$date' ,  eob_date <='$date1'"); 

however when try replace variables string value, query works:

$result=mysqli_query($dbc,"select  id_eob eob_posting  eob_date >='2016-05-20' ,  eob_date <='2016-05-25'") 

can explain me have done wrong , how solve issue ?

i faced problem before... think experience php not interpreting correct type of variable when passing sql. try php built in function convert string:

$date = strval($date); 

try stating before pass on query.

my problem once similar in case taking integer , passing string.

this may solve issue... still, give feedback.

good luck!


Comments