I have written a code to fetch the data from database, but its ended up with an error
A PHP Error was encountered Severity: Notice Message: Undefined index: username Filename: views/userinfo.php Line Number: 20 Backtrace:
File: D:\wamp\www\anand\codeigniter\application\views\userinfo.php Line: 20 Function: _error_handler
File: D:\wamp\www\anand\codeigniter\application\controllers\Main.php Line: 35 Function: view
File: D:\wamp\www\anand\codeigniter\index.php Line: 315 Function: require_once
My code is
?php
$name=$this->session->username;
$pass=$this->session->password;
$q=$this->db->query("select * from signup where username='$name' and password='$pass'");
$data=$q->result();
echo $data['username'];
echo $data['password'];
?>
kindly give a suggestion to fetch the data in a correct format..
session? and can your more explain how you are handing this request - Aman MauryaPOSTthen you can get like this$_POST['username'],but this not the best way to do in CI - Aman Maurya