Fatal error: Call to a member function bindValue() on null

 

錯誤訊息:Fatal error: Call to a member function bindValue() on null

 

此錯誤原因為執行時沒有引用到$dbc->prepare($sql);

 

完整使用

$sql=”SELECT * FROM TEST WHERE ID:id ”;

$dbc = new ConnDB(ConnDB::$CHARSET_AL32UTF8);

$stmtSel = $dbc->getConnection()->prepare($sql); //這段沒有引用到造成上述的錯誤

$stmt->bindValue(":id", $id, PDO::PARAM_STR);

$stmtSel->execute();



參考網址:https://stackoverflow.com/questions/19681463/error-in-pdo-page-call-to-a-member-function-bindvalue-on-a-non-object

留言

這個網誌中的熱門文章

IIS-Microsoft OLE DB Provider for ODBC Drivers 錯誤 '80004005'

ORA-12899: value too large for column