I don't get any result when executing a SQL sentence where I use TRUNC in the WHERE clause in PHP -


i have table in oracle database called reservation has datetime column called date_reservation. , have following code:

$sql = "select count(*) numberrows reservation trunc(date_reservation)=to_date('15/06/2015', 'dd/mm/yyyy')"; $stid = $this->bd->execute($sql); $row = $this->bd->get_row($stid, 0); echo $row['numberrows']; 

the table content is:

id    ...     date_reservation 1             13/06/2015 12:00:00 2     ...     15/06/2015 09:00:00 3     ...     15/06/2015 11:00:00 

when execute php code 0, , should 2. if execute sql sentence in db admin tool 2.

if remove clause code ($sql = select count(*) numberrows reservation) number of rows in reservation table.

so guess wrong trunc in php. how solve it?

it seems miss semicolumn @ line 1 :

$sql = select count(*) numberrows reservation trunc(date)=to_date('15/06/2015', 'dd/mm/yyyy'); $stid = $this->bd->execute($sql); $row = $this->bd->get_row($stid, 0); echo $row['numberrows']; 

maybe came that? :)


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -