Jump to content

PDO::PARAM_DATE??


cougar23

Recommended Posts

I'm using PDO and trying to bind a date parameter.  For example, my parameter is '2008-08-08' and I'm trying to set that as a parameter for more query but I get "Fatal error: Undefined class constant 'PARAM_DATE' ".  Any ideas why I would be getting this error?  Should I just pass the date as a STR type?  Would MySQL convert that to a DATE automatically, as that's what the column type in the DB is?

 

(NOTE: i have a $dbManager object that handles my connection and loops through binding parameters, etc)

 

$query = 'update ADVISING_APPOINTMENT a
			  set a.STUDENT = null
    			  where a.STUDENT = :studentId
				and a.APPT_DATE = :apptDate
				and a.APPT_START_TIME = :apptStartTime
				and a.APPT_END_TIME = :apptEndTime';
	$queryHolders = array(':studentId', ':apptDate', ':apptStartTime', 'apptEndTime');
	$params = array($studentId, $apptDate, $apptStartTime, $apptEndTime);
	$paramTypes = array(PDO::PARAM_INT, PDO::PARAM_DATE, PDO::PARAM_TIME, PDO::PARAM_TIME);

	$results = $dbManager->doPreparedStmt($query, $queryHolders, $params, $paramTypes);

Link to comment
https://forums.phpfreaks.com/topic/123731-pdoparam_date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.