0

Could you please tell me what is the purpose of GetAll(){}; method. And, why when I change the name of method gives me an Error? Is it a type of reserved method, or how? I know that the method is dedicated to execute code so? why it does not execute code when I change it from GetAll() to anything()?

<?
class araclar_model extends CI_Model
{
    public $tableName = "";
    public function __construct()
    {
        
        $this-> tableName = "tbl_araclar";
    }

    public function GetAll()
    {
        //araçlar tablosundaki tüm satırları listeleyen metot
        //select * from tbl_araclar
        return $this->db->get($this->tableName)->result();
    }

    public function Get($id)
    {
        //tek bir aracı listeleyen metot
        //SQL sorgusu: select * from tbl_araclar where arac_id=5
        return $this->db->where("arac_id",$id)->get($this->tableName)->row();
    }
}
?>

I will really pleased for helping.

2
  • 1
    I don’t know much about CodeIgniter, but I’d assume that the purpose of a method called GetAll is to retrieve all records from the table that the model represents, and there appears to be a SQL query in the comments that confirms this. Commented Mar 31, 2024 at 12:58
  • 1
    “why when I change the name of method gives me an Error” - what is the error? Commented Mar 31, 2024 at 12:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.