我剛剛在Windows 7框,IIS 7,快速CGI,沒有模塊設置一個簡單的PHP代碼點燃器項目。代碼點火器加載數據庫似乎停止進程線程
當我通過做這樣的this->load->database()
加載數據庫在Model類的函數之一時,線程似乎停止在該特定行上。以後的操作都沒有完成。
class Account_model extends Model {
var $userId = '';
var $userName = '';
var $requestToken = '';
var $accessToken = '';
var $enabled = false;
var $startOfDay;
var $endOfDay;
function Account_model() {
parent::Model();
}
function get($userId) {
$this->load->database();
$query = $this->db->get_where('accounts', array('userId' => $userId), 1, 0);
return $query->result();
}
function insert() {
$this->load->database();
// ** stop **
$this->db->insert('accounts', $this); //never gets to this
}
}
如果我只是ommit該行完全,我得到了模型中的PHP異常不確定的變量$分貝。
主叫控制器:
class SignUp extends Controller {
function SignUp() {
parent::Controller();
}
function createUser() {
echo 'processing';
$this->load->model('Account_model');
$this->Account_model->userId = 'asd';
$this->Account_model->userName = 'test_user_pls_delete';
$this->Account_model->enabled = true;
$this->Account_model->startOfDay = time();
$this->Account_model->insert();
echo 'done'; // never gets to this
}
}
我已經驗證數據庫配置是正確的(主機名,驅動程序等),並且能夠從使用MySQL workbrench本機連接到數據庫服務器。
$active_group = "default";
$active_record = TRUE;
$db['default']['hostname'] = "{omitted}";
$db['default']['username'] = "{omitted}";
$db['default']['password'] = "{omitted}";
$db['default']['database'] = "{omitted}";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
數據庫表名:佔
- ID INT(11)主鍵的auto_increment
- 用戶ID VARCHAR(255)utf8_general_ci
- userName的VARCHAR(255)utf8_general_ci
- requestToken VARCHAR (255)utf8_general_ci
- AccessToken varchar(255)utf8_general_ci
- 啓用TINYINT(1)
- startOfDay時間
- endOfDay時間
關於如何解決此問題的任何想法?
介意發佈你的database.php? – Orbit 2010-10-23 17:37:13
當您不發佈代碼時無法提供幫助。我們需要查看拋出此錯誤的代碼,錯誤本身以及可能的db配置設置。 – treeface 2010-10-23 19:38:58
感謝球員,在線添加 – ronaldwidha 2010-10-24 13:23:19