Skip to content

Commit

Permalink
Use built-in array_merge() function to deal with multiple queries.
Browse files Browse the repository at this point in the history
Ensure every query has an associated result, even if the query is empty.
  • Loading branch information
GPHemsley committed Mar 26, 2012
1 parent 5283d0f commit 9b99821
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions inc/database/database.mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ function query( $query )
}
else
{
$queries = array();

if( is_array( $query ) )
{
foreach( $query as $single_query )
{
$queries[] = $single_query;
}
$queries = array_merge( $queries, $query );
}
else
{
Expand Down Expand Up @@ -187,6 +186,10 @@ function query( $query )
$this->results[$this->query_count] = $result;
}
}
else
{
$results[$this->query_count] = FALSE;
}
}

return ( ( count( $results ) > 1 ) ? $results : $results[$this->query_count] );
Expand Down

0 comments on commit 9b99821

Please sign in to comment.