[eluser]Thorpe Obazee[/eluser]
oK. I am having a problem with my code. I am trying to echo a "true". So far I cannot echo a "true" here. There must be something that I am doing wrong :|
Code:
class Loan extends Controller {
function Loan(){
parent::Controller();
}
function auth(){
if ($this->input->post('submit')){
$u = $this->input->post('u');
$p = $this->input->post('p');
$this->load->model('loan_model');
$query = $this->loan_model->auth($u,$p);
if ($query->num_rows() > 0){
echo 'true';
}else{
echo 'false';
}
}else{
$this->load->view('auth_view');
}
}
}
model:
Code:
<?php
class Loan_model extends Model {
function Loan_model() {
#call to Model constructor
parent::Model();
}
function auth($u, $p){
$auth_query = $this->db->query("SELECT username, password FROM users WHERE username = '".$u."' AND password = '".$p."'");
return $auth_query;
}
}