fightbulc / simplon_mysql

MySQL PDO Wrapper (php, mysql, pdo, crud, library)
70 stars 22 forks source link

`getColumnsMany()` fails when some db value evaluates to `false` #22

Open AitorF opened 3 years ago

AitorF commented 3 years ago

If any of the DB values returned by pdoStatement->fetchColumn() evaluates to false, lets say, a 0, getColumnsMany() will break and return the values got until that moment, losing the rest of the values. I recommend to use getColumnsManyCursor() instead until this is solved.

The solution is quite easy, replace the line 156 of Mysql.php:

while ($response = $pdoStatment->fetchColumn())

with:

while (($response = $pdoStatment->fetchColumn()) !== false)