use array_key_exists instead of isset so that we can return nulls

This commit is contained in:
Isaac Connor 2018-04-18 14:21:27 -04:00
parent d31207dd53
commit 75248e7465
1 changed files with 4 additions and 4 deletions

View File

@ -164,16 +164,16 @@ function dbFetchOne( $sql, $col=false, $params=NULL ) {
return false; return false;
} }
if ( $result && $dbRow = $result->fetch( PDO::FETCH_ASSOC ) ) { if ( $result && $dbRow = $result->fetch(PDO::FETCH_ASSOC) ) {
if ( $col ) { if ( $col ) {
if ( ! isset( $dbRow[$col] ) ) { if ( ! array_key_exists($col, $dbRow[$col]) ) {
Warning( "$col does not exist in the returned row " . print_r($dbRow, true) ); Warning("$col does not exist in the returned row " . print_r($dbRow, true));
} }
return $dbRow[$col]; return $dbRow[$col];
} }
return $dbRow; return $dbRow;
} }
return( false ); return false;
} }
function dbFetchAll( $sql, $col=false, $params=NULL ) { function dbFetchAll( $sql, $col=false, $params=NULL ) {