0

I've got some code that needs to work.

But although connection is ok, I can't get it to work

This is code:

$dbh = newPDO(data); $v = $dbh->query('SELECT COUNT(1) as num FROM wia_administratorzy')->fetchColumn();

I've got error:Fatal error: Call to a member function fetchColumn() on boolean

Please explain what is not working here.

Aksebkit
  • 127
  • 1
  • 13
  • PHP docs: `PDO::query()` returns a `PDOStatement` object, or `FALSE` on failure. It seems your query failed to execute. – user2890234 Jan 25 '17 at 12:45
  • `PDO::query() returns a PDOStatement object, or FALSE on failure.` so you have an error with `on boolean` so you query returns not a PDOStatement object (it returns false). – JustOnUnderMillions Jan 25 '17 at 12:46
  • Should I use prepare? Then Execute? Or what? This query works good for MySQL – Aksebkit Jan 25 '17 at 12:58

0 Answers0