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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.