PDO, binding within a class
| From: | Richard Thomas | Date: | Mon, 24 Oct 2005 18:49:44 +0000 |
| Subject: | PDO, binding within a class | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-3149@lists.php.net to get a copy of this message | ||
I am tried to define a prepare statement and bind varaibles within the construct of a class to use everytime a function within the class was called..
No errors reported, it just doesn't run like all the values are empty.
class testing {
private $stmt = NULL;
private $stmtvar1 = NULL;
private $stmtvar2 = NULL;
private $db = NULL;
function __construct( $db ) {
$this->db = $db;
$this->stmt = $this->db->prepare('INSERT STATEMENT');
$this->stmt->bindParam(':var1', $this->stmtvar1);
$this->stmt->bindParam(':var2', $this->stmtvar2);
}
function noworkie() {
$this->stmtvar1 = 'Something';
$this->stmtvar2 = 'Something else';
$this->stmt->execute();
}
function workie() {
$this->stmtvar1 = 'Something';
$this->stmtvar2 = 'Something else';
$this->stmt->bindParam(':var1', $this->stmtvar1);
$this->stmt->bindParam(':var2', $this->stmtvar2);
$this->stmt->execute();
}
}
No visible errors can be found, errorInfo and errorCode both return no error
RC1 in both PDO and Mysql
--
Richard Thomas - CEO
Cyberlot Technologies Group Inc.
507.398.4124 - Voice