内部服务器错误Zend查询


Internal Server Error Zend Query

我的查询有问题吗服务器遇到内部错误或配置错误,无法完成您的请求。

请联系服务器管理员@@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();

这看起来像是在尝试使用Zend中的命名参数执行PDO语句。

首先要检查的是,我想你已经开始交易了?

此外,根据我的经验,命名参数在查询中与params数组中相同,例如:param1是$params = array(':param1'=>'data');

我使用与ZF文档"使用命名参数执行语句"中描述的方法相同的方法:

$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!
}