I'm trying to display all my data in a table name contacts but it gives me an error Call to a member function find() on null. I don't understand what it means. Please help!
<?php
class ContactsController extends AppController {
var $name = "Contacts";
public function index() {
$this->set('contacts', $this->Contacts->find('all'));
}
}
?>
In your controller.
<?php
class ContactsController extends AppController {
public function index() {
$this->set('contacts', $this->Contact->find('all')); // here the change Contacts to Contact.
}
}
?>
Your Model.
<?php
class Contact extends AppModel {
var $name = "Contact";
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With