Added associate fetch function.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2705 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
bcb7166b75
commit
69b9f78343
|
@ -127,6 +127,18 @@ function dbFetchAll( $sql, $col=false )
|
||||||
return( $dbRows );
|
return( $dbRows );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbFetchAssoc( $sql, $indexCol, $dataCol=false )
|
||||||
|
{
|
||||||
|
dbLog( $sql );
|
||||||
|
if (!($result = mysql_query( $sql )))
|
||||||
|
dbError( $sql );
|
||||||
|
|
||||||
|
$dbRows = array();
|
||||||
|
while( $dbRow = mysql_fetch_assoc( $result ) )
|
||||||
|
$dbRows[$dbRow[$indexCol]] = $dataCol?$dbRow[$dataCol]:$dbRow;
|
||||||
|
return( $dbRows );
|
||||||
|
}
|
||||||
|
|
||||||
function dbFetch( $sql, $col=false )
|
function dbFetch( $sql, $col=false )
|
||||||
{
|
{
|
||||||
return( dbFetchAll( $sql, $col ) );
|
return( dbFetchAll( $sql, $col ) );
|
||||||
|
|
Loading…
Reference in New Issue