MySQL的兩種程序和會話分貝我有一個這樣的控制器:使用代碼點火器的原因`2014`錯誤
$r_result = $this->storedprocedure->user_email_exist($in_email);
if($r_result->num_rows() == 1)
{
foreach ($r_result->result() as $row)
{
$salt = $row->salt;
$hash = $row->hash_password;
if(strcasecmp(Application_Helper::hash_password($aData['password'], $salt),
$hash)==0)
{
//Login success
echo('login success');
$newdata = array('user_id' => $row->id);
$this->session->set_userdata($newdata);
}
}
}
在StoredProcedure的模型,是這樣的:
public function user_email_exist($aEmail)
{
$r_result = $this->db->query("CALL user_email_exist('".$aEmail."')");
return $r_result;
}
我測試它,它可以登錄成功,但打印錯誤:
A Database Error Occurred
Error Number: 2014
Commands out of sync; you can't run this command now
UPDATE
ci_sessions
SETlast_activity
= 1358764263,user_data
= 'a:2:{s:9:\"user_data\";s:0:\"\";s:7:\"user_id\";s:2:\"35\";}' WHEREsession_id
= '05e340b2aa6bd9b21261ed0d20354b3c'Filename: libraries/Session.php
Line Number: 289
的問題是,我必須使用MySQL procedure
來實現模型層,但似乎在ci_session之間有一些衝突。任何推薦解決方案的問題?謝謝。
嗨@Ted皇請讓我知道,如果這有助於。 – OMG
嗨,它不起作用。 'PHP致命錯誤:調用未定義的方法CI_DB_mysqli_result :: next_result()。 '相反,我這樣做:'$ this-> db-> close();' 登錄成功後,它在沒有錯誤的情況下工作。我不知道這是一種正確的做法。 – DNB5brims