I'm trying to catch the information about PHP moreover I've got a project working with CakePHP but it's hard for me to get understand how is CakePHP working.
I created the database with table is Vkx and 4 columns is User_name , User_id , User_password, User_email I created in model a PHP file : User.php
The code: Model file : User.php
<?php
class User extends AppModel{
public $name = 'User';
}
?>
Controller File : UsersController
class UsersController extends AppController{
public function hello_user(){
$user = $this->User->findByuser_id(1);
$this->set('user',$user);
}
}
Then in Views foder i created Users forder and "Hello_user.ctp" inside:
echo "hello , ".$user['User']['user_name']."!";
And the Error is:
Undefined index: User [APP\View\Users\hello_user.ctp, line 8]
$user['User']['user_name']with$user['user_name']- Phantomdebug($user)to inspect the variable, or install the Debug Kit plug-in - Álvaro GonzálezVkx? - cornelb