In the past, I was involved in creating a large number of websites using my own cms / framework, and I developed a simple way to execute requests. I recently started playing with other frameworks such as a code igniter. They offer original queries such as ...
$this->db->query("SELECT * FROM news WHERE newsId=1;");
But they also offer a MySQL command chain using PHP methods.
$this->db->select("*")->from("news")->where("newsId=?");
The question arises: what is the main difference and advantages of each option.
I know that the latter options prevent the implementation of MySQL, but to be honest, you can do the same with $this->db->escape() .
So, in the end, from what I see, the last option is only for you to use more letters on the keyboard, this, in your opinion, will slow you down.
source share