0
Codeigniter與數據庫連接但沒有來自數據庫表的查詢響應。我的數據庫已經從PostgreSQL的轉換到MySQL,我們的表類型是InnoDB的,但我在創建服務器的Godaddy的樣本表的表型是MyISAM.I不知道什麼是我面臨Codeigniter在Godaddy上查詢空響應,但在本地主機上工作正常
.htaccess中的問題
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
login_view.php
var name = {
ajax: 1,
name: $('#login-username').val()
}
$.ajax({
url: base_url+"login/username_validation",
type: 'POST',
data: name,
dataType: 'json',
success: function(data)
{
$.each(data.response.userid, function (a, b)
{
if((b.count) == 1)
{
$("#login").removeAttr("style");
$(".alertbox").css("display", "none");
$("#login-password") .focus();
}
});
的login.php
public function username_validation()
{
if ($this->input->post('ajax'))
{
$username = $this->input->post('name');
$result['userid'] = $this->common_model->chk_username($username);
$this->output->set_content_type('application/json')->set_output(json_encode(array('response'=>$result)));
}
}
common_model.php
public function chk_username($username)
{
$this->db->select('count(*) as count');
$this->db->from('mas_user');
$this->db->where('login_id',$username);
return $this->db->get()->result();
}
MySQL表
user_creation_id login_id password
1 admin admin123
後
ajax : 1
name :admin
響應
{"response":{"userid":[]}}
status 200 ok