//here is my function block
public function create_accnt()
{
$post = $this->input->post(); //gets all possible posts in array form
echo "Post array: ";print_r($post); // just to make sure that my array has values
$data = array(
'userid' => $post['user_id'],
'lastname' => $post['lname'],
'firstname' => $post['fname'],
'username' => $post['username'],
'password' => $post['password'],
'usertype' => $post['user_type'],
'status' => 'A'
); // assigning my values to their specific fields where they will be inserted
$query = $this->db->insert('accounts', $data); //insertion via active record
echo "<br/>Result of db last query: ";
echo $this->db->last_query();//to see how my query looks in code form
if($query)
{
return true;
}
else
return false;
// end if
} // end function
//here is the result of the code above
//Post array: Array ([user_id] => 123456 [lname] => Smith [fname] => John [username] => John [password] => password [c_password] => password [user_type] => S [btn_create] => Create)
//Result of db last query: INSERT INTO accounts (userid, lastname, firstname, username, password, usertype, status) VALUES ('', '', '', '', '', '', '')
這裏爲什麼查詢後我的VALUES都是空格?順便說一句,我使用CodeIgniter和我的數據庫驅動程序是PDO和我的數據庫是DBFoxPro。爲什麼我的INSERT語句的VALUES在執行後轉向了SPACES?
因爲您的發佈數據中包含空間,所以您將節省空間在db..first檢查什麼是在帖子和你在db中保存什麼.. – saveATcode 2013-04-18 06:29:39
@saveATcode仔細閱讀問題。 – 2013-04-18 06:30:30
@YogeshSuthar:可能是我能夠得到問題,你能解釋他究竟在問什麼嗎? :) – saveATcode 2013-04-18 06:33:34