note 97130 added to pdo.constants
| From: | Axeia at osu1 dot php dot net | Date: | Fri, 02 Apr 2010 17:21:46 +0000 |
| Subject: | note 97130 added to pdo.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167660@lists.php.net to get a copy of this message | ||
If you're reading in information from an array to use in a prepared statement you may find the
following function useful.
<?php
function getPDOConstantType( $var )
{
if( is_int( $var ) )
return PDO::PARAM_INT;
if( is_bool( $var ) )
return PDO::PARAM_BOOL;
if( is_null( $var ) )
return PDO::PARAM_NULL;
//Default
return PDO::PARAM_STR;
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 24.132.222.68
----
Manual Page -- http://www.php.net/manual/en/pdo.constants.php
Edit -- https://master.php.net/note/edit/97130
Del: integrated -- https://master.php.net/note/delete/97130/integrated
Del: useless -- https://master.php.net/note/delete/97130/useless
Del: bad code -- https://master.php.net/note/delete/97130/bad+code
Del: spam -- https://master.php.net/note/delete/97130/spam
Del: non-english -- https://master.php.net/note/delete/97130/non-english
Del: in docs -- https://master.php.net/note/delete/97130/in+docs
Del: other reasons-- https://master.php.net/note/delete/97130
Reject -- https://master.php.net/note/reject/97130
Search -- https://master.php.net/manage/user-notes.php