2012-01-11 66 views
-2

我的查詢出錯了 服務器遇到內部錯誤或配置錯誤,無法完成您的請求。內部服務器錯誤Zend查詢

請聯繫服務器管理員@@ ServerAdmin @@並告知他們錯誤發生的時間以及您可能已經犯的任何可能導致錯誤的事情。

有關此錯誤的更多信息可能在服務器錯誤日誌中可用。

$sql = $db->query(
"INSERT INTO users (user_id, title, first_name, last_name, user_identity_id, email_id, password, office_phone_number, public_id, session_id, address_id, created_by, last_modified_by, created_on, last_modified_on, is_activated, is_deprecated, middle_name, cell_phone_number, superviser_name, superviser_email, superviser_phone_number) 
VALUES(:p_user_id,:p_title,:p_first_name,:p_last_name,:p_user_identity_id,:p_email_id,:p_password,:p_office_phone_number,:p_public_id,:p_session_id,:p_address_id,:p_created_by,:p_last_modified_by,:p_created_on,:p_last_modified_on,:p_is_activated,:p_is_deprecated,:p_middle_name,:p_cell_phone_number,:p_superviser_name,:p_superviser_email,:p_superviser_phone_number)", 
array(
'p_user_id' => '', 
'p_title' => $title, 
'p_first_name' => $first_name, 
'p_last_name' => $last_name, 
'p_user_identity_id' => '', 
'p_email_id' => $email, 
'p_password' => $pass, 
'p_office_phone_number' => $office_ph_no, 
'p_public_id' => '', 
'p_session_id' => '', 
'p_address_id' => '', 
'p_created_by' => '', 
'p_last_modified_by' => '', 
'p_created_on' => '', 
'p_last_modified_on' => '', 
'p_is_activated' => '', 
'p_is_deprecated' => '', 
'p_middle_name' => $middle_name, 
'p_cell_phone_number' => $cell_ph_no, 
'p_superviser_name' => $supervisor_name, 
'p_superviser_email' => $supervisor_email, 
'p_superviser_phone_number' => $supervisor_ph_no 
) 
); 
$db->commit(); 
+0

請看一看錯誤日誌和更新你的問題。 – ZeroSuf3r 2012-01-11 14:37:40

回答

0

這看起來像你正試圖在Zend中使用命名參數執行PDO語句。

首先要檢查,我假設你已經開始交易?

此外,根據我的經驗,命名參數在查詢中與在params數組中相同,例如, :參數1是$params = array(':param1'=>'data');

我用作爲ZF文檔"executing a statement using named parameters"相同的方法:

$select = 'select col1,col2 from my_table where con1=:param1 and con2=:param2'; 
$params = array(
    ':param1'=> 'somedata', 
    ':param2'=> 'someotherdata' 
); 
$statement = new Zend_Db_Statement_Pdo($db,$sql); 
if($statement->execute($params)){ 
    //ok! 
}