• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem getting results

#2
[eluser]chmod[/eluser]
if i was you,i can write the the below:
controller:
$username = $this->input->post('username');
$password = $this->input->post('password');

$result = $this->model->check_user($username,$password);
if ($result)
{
//login
}else{
echo "Username and/or Password not recognized - Please try again.";
}
model:
class Login extends Model {

function login()
{
parent::Model();
$this->load->database();
}
function check_user($username,$password)
{

$query = $this->db->get_where('auth_users',array('username' => $username, 'password' => $password)) ;

if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$un = $row->username;
$pw = $row->password;

if ($un == $username and $pw == $password)
{
return true;
}
}
}else{
return false;
}
}
}


Messages In This Thread
Problem getting results - by El Forum - 06-12-2008, 07:35 AM
Problem getting results - by El Forum - 06-12-2008, 07:41 AM
Problem getting results - by El Forum - 06-12-2008, 08:00 AM
Problem getting results - by El Forum - 06-19-2008, 01:56 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.