I am querying usernames from database using the get() function in the DB class.. its always returning \'No users\' even if there are users existing in the database.. here is my
Please look at this answer Row count with PDO
PDO has PDOStatement::rowCount(), which apparently does not work in MySql. What a pain.
In your query function when binding you do:
foreach ($params as $param) {
$this->_query->bindValue($x, $params);
$x++;
}
You are binding $params
which is an array, not the value. Change $params
to $param
(singular) and it will likely work.
Try changing
$sql = "{$action} FROM {$table} WHERE {$field} {$operator} ?";
to
$sql = "{$action} FROM {$table} WHERE {$field} {$operator} {$value}";