Help with code -

Hi,

I’m brand new to PHP and taking a class in Udemy. I copy all the code from the instructor and I’m getting the following error: Undefined variable: crud on line 39.

I didn’t see any CRUD declarations on the instructors code. What am I missing?

Here’s my code:http://pastebin.com/6FEFFAcy

Best,
Diego

$crud is undefined in these places.

[php] public function select($columns, $where){
$this->_isTableSet();
$crud->select(’*’, [‘project_id’ => 2]); // <--------------
}[/php]

[php] public function insert($data){
$this->_isTableSet();
// Return the insert ID
$crud->insert([‘data’ => 1]); // <--------------
}[/php]

[php] public function update(){
$this->_isTableSet();
// Return TRUE/FALSE (boolean)
$crud->update([‘data’ => 1], [‘project_id’ => 1]); // <--------------
}[/php]

[php] public function delete($where = array()){
$this->_isTableSet();
// Return TRUE/FALSE (boolean)
$crud->delete([‘project_id’ => 2 ]); // <--------------
}[/php]

You should use an IDE, it will point this out for you :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service