PHP-MySQLi-Database-Class icon indicating copy to clipboard operation
PHP-MySQLi-Database-Class copied to clipboard

getValue return NULL instead array

Open itajackass opened this issue 1 year ago • 1 comments

Hi, with this code:

$logins = $db->getValue ("users", "login", 5);
// select login from users limit 5
foreach ($logins as $login)
    echo $login;

All is ok if results found. But if NO RESULT FOUND, we get error:

 Warning: foreach() argument must be of type array|object, null given

itajackass avatar Oct 16 '24 12:10 itajackass

Use is_array before doing foreach

abasnet avatar Nov 01 '24 17:11 abasnet