mith36
06-30-2009, 02:56 PM
I am trying to use this query...
$query = "SELECT val FROM obs WHERE id='".$_GET['id']."' AND obsdate >= '".$hisdate."' AND obsdate <= '".$curdate."' AND MONTH(obsdate) = '".$mosel."' ";
... that translate to ...
SELECT val FROM obs WHERE id='GBYC2' AND obsdate >= '1969-06-01' AND obsdate <= '2009-06-01' AND MONTH(obsdate) = '01'
... to try and select records only of the month indicated by php var $mosel.
Everytime I try to use a month/date function on the obsdate column (which is of type date), I get a weird error...
ERROR: function month(date) does not exist LINE 1: ...e >= '1969-06-01' AND obsdate <= '2009-06-01' AND MONTH(obsd... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
What's wrong here?
$query = "SELECT val FROM obs WHERE id='".$_GET['id']."' AND obsdate >= '".$hisdate."' AND obsdate <= '".$curdate."' AND MONTH(obsdate) = '".$mosel."' ";
... that translate to ...
SELECT val FROM obs WHERE id='GBYC2' AND obsdate >= '1969-06-01' AND obsdate <= '2009-06-01' AND MONTH(obsdate) = '01'
... to try and select records only of the month indicated by php var $mosel.
Everytime I try to use a month/date function on the obsdate column (which is of type date), I get a weird error...
ERROR: function month(date) does not exist LINE 1: ...e >= '1969-06-01' AND obsdate <= '2009-06-01' AND MONTH(obsd... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
What's wrong here?