所以。我一直在尝试更新密码。随机生成。但。如果我刷新数据库,没有任何反应。我的代码有什么问题?
这是我的控制器:
function create_password()
{
$this->load->model('members_model');
$newRow = array(
'name' => $this->input->post($a);
'value' =>
);
$this->membership_model->passchange($newRow);
}
这是我的模型:
function passchange()
{
$this->db->select();
$this->db->from('membership');
$this->db->where('security_answer',$this->session->userdata('security_answer'));
$q=$this->db->get();
if($q->num_rows() > 0) {
$data = array();
foreach($q->result() as $row) {
$data['result']=$row;
$this->db->where('email_address', $this->session->userdata('email_address'));
$this->db->update('membership', 'password');
}
return $data;
}
}
这是我的观点:
<?php echo form_open('login/create_password')?>
<?php $this->load->view('includes/header');
$CI =& get_instance();
$CI->load->model('membership_model');
$result = $CI->membership_model->passchange();
foreach($result as $row) {
}
?>
Your Email Address is: <?php echo $row->email_address;?> <br/>
<?php
$a = random_string('alnum', 6);
?>
Your password is: <?php echo $a; "<br/>"?>
<p align="right"><?php echo anchor('login/signin', 'Back to Login Page'); ?></p>
我数据库中的密码为空。它没有更新。请帮忙。先感谢您!:)