Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Codeigniter-Help login form

Links for php scripts

Moderators: macek, egami, gesf

Codeigniter-Help login form

Postby verodostojan » Tue Feb 05, 2013 5:02 am

My model:

Code: Select all
<?php

class LoginModel extends CI_Model
{
    public function login($user, $pass)
    {
        $this->db->where('username', $user);
        $this->db->where('password', md5($pass));
       
        $query = $this->db->get('korisnici');
       
       
        if ($query->num_rows() == 1)
        {
            $obj = array();
            foreach ($query->result() as $row) {
                $obj[] = $row;
                return $obj;
                $this->getData($obj);
            }
            return TRUE;
        }
        else            return FALSE;
    }
   
    public function getData($obj)
    {
     
        $this->db->where('id', $obj['id']); 
    $upit = $this->db->get('korisnici');
       return $upit->result();
    }
}

?>


My view:

Code: Select all
<div id="pocetak">
                <?php
                foreach ($records as $rec){
                     echo "<p id='bbb'><b >" .$rec->username. "</b>:dobrodosli</p>";
                }
               
                ?>


My Controller:

Code: Select all
public function checkAdmin()
    {
        $this->load->model('LoginModel');
        $data['records'] = $this->LoginModel->getData($obj);
       
        $this->load->view('pocetna_admin', $data);
    }


When I start project, I get this:

Code: Select all
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: obj
Filename: controllers/LoginController.php
Line Number: 50


I need help!!!
verodostojan
New php-forum User
New php-forum User
 
Posts: 1
Joined: Tue Feb 05, 2013 4:55 am

Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron