Question: ```
>>> help(bytearray.count)
Help on method_descriptor:

count(...)
    B.count(sub[, start[, end]]) -> int

    Return the number of non-overlapping occurrences of subsection sub in
    bytes B[start:end].  Optional arguments start and end are interpreted
    as in slice notation.

>>> b = bytearray(b'abcd')
>>> b
bytearray(b'abcd')
>>> b.count('a')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: Type str doesn't support the buffer API

```

Question> How to use count for bytearray?

Answer: 
Well, with CI you can:

```
$sql = "SELECT * FROM table WHERE name = ? AND email = ?";
$query = $this->db->query($sql, array($name,$email));

return $query->row_array();

```

This binds the $name and $email variable to th respective positions inside the query string. Is this what you mean?
There's also [Active Record](http://codeigniter.com/user_guide/database/active_record.html) (a custom ORM, or sortof), which is pretty nice. 

All of the above automatically escape values. You can also escape manually with `$this->db->escape($string)` and, for column names, with `$this->db->protect_identifier($column_name)`. But it's all in the manual, have a read at it.
You can use [`PDOStatement::bindParam()`](http://php.net/manual/en/pdostatement.bindparam.php), which may be significantly faster than CIs functions, depending on the use case.