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