Re: PEAR::MBD2
| From: | Justin Patrin | Date: | Fri, 17 Nov 2006 18:32:42 +0000 |
| Subject: | Re: PEAR::MBD2 | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25864@lists.php.net to get a copy of this message | ||
On 11/17/06, Damian Bursztyn <dbursztyn@gmail.com> wrote:
Hi, my Name s Damian from Argentina. Im tryn to work with MDB2 but have some question. Mostly about working with dates. Im working with SQL Server wich date type has the date and the time all together. The question is this: I have the a table events wich a column event_date of type date. I want to know if there is some event for to day. To do this im doing:Unless you set up this column as a date via MDB2 and have always let MDB2 update this data with its date format, you don't want "date" here, you want "text" and a manually formatted date. If you have, on the other hand, always used MDB2's date type handling, then using the date type should be fine here.$sSQL = "SELECT * " . "FROM events " . "WHERE event_date = :date ";$dataTypes['event_date'] = 'date';
$db->bindParam('event_date', MDB2_Date::mdbToday());
However, I don't think this line is right. You named your placeholder
:date above but are binding 'event_date" down here. Try renaming one
of them.
$stmt = $db->prepare($sSQL, $dataTypes, true);
$result = $stmt->query();
$result->free();
Is this ok or i have to format event_date to special format or something?
MDB2 format the datetime converting it just to date?
--
Justin Patrin