CodeIgniter Forums
database connectivity - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: database connectivity (/thread-53632.html)

database connectivity - El Forum - 08-01-2012

dear all i have the following controller


class Admin extends CI_Controller {

function __constructor(){
} //constructor ended
public function index(){

} //index function ended
public function administrator(){
$rzlt =$this->admin_model->login();}


and have the following view


<form action="<?php echo base_url();?>admin/administrator" method="post" name="form">
<label> UserName</label>
&lt;input type="text" name="un" /&gt;
<label> Password </label>
&lt;input type="password" name="pass" /&gt;
&lt;input type="submit" value="submit" name="submit" /&gt;


and model in the following as well

class Admin_model extends CI_Model{

function __construct(){
public function db(){
echo "i m admin";
public function login(){
require "db.php";
$all = "SELECT * FROM admin"; //getting all data from the user
$use = $_POST['un'];
$pas =$_POST['pass'];
$sub = $_POST['submit'];
$rzlt= mysql_query($all);
while ($show = mysql_fetch_array($rzlt))

if($show['username']==$use && $show['password']==$pas)
echo "you are logged in as administrator";}
echo "plz try again to login";



and my other file of db contain the database connectivity only. after run this code m intnimate that the un, pas and submit are not defined.
any body is there to help me in this regard..
thnx in advance Wink