Welcome Guest, Not a member yet? Register   Sign In
count without Active Record
#1

[eluser]introvert[/eluser]
Hello,

What is the easiest // the most resource friendly way to count results?

Code:
$query = $this->db->query("SELECT count(*) FROM $this->table WHERE site_id = $this->site_id AND permalink = '$unique'");


How to access count variable?
#2

[eluser]Nick_MyShuitings[/eluser]
K.

1) You are not using AR... remember that you are just using the database class... (this is good... its quicker to write the SQL)
2) You should use query bindings for your variables, check the user guide
3) Just add this "... count(*) as amount..." and then return $query->row();




Theme © iAndrew 2016 - Forum software by © MyBB