Changeset 25427 for trunk/include/functions.inc.php
- Timestamp:
- Nov 10, 2013, 6:03:25 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r25426 r25427 1315 1315 1316 1316 /** 1317 * creates a numeric array based on a SQL query. 1318 * if _$fieldname_ is empty the returned value will be an array of arrays 1319 * if _$fieldname_ is provided the returned value will be a one dimension array 1320 * 1321 * @param string $query 1322 * @param string $fieldname 1323 * @return array 1324 */ 1325 function array_from_query($query, $fieldname=false) 1326 { 1327 $array = array(); 1328 1329 $result = pwg_query($query); 1330 if (false === $fieldname) 1331 { 1332 while ($row = pwg_db_fetch_assoc($result)) 1333 { 1334 $array[] = $row; 1335 } 1336 } 1337 else 1338 { 1339 while ($row = pwg_db_fetch_assoc($result)) 1340 { 1341 $array[] = $row[$fieldname]; 1342 } 1343 } 1344 return $array; 1345 } 1346 1347 /** 1317 1348 * Return the basename of the current script. 1318 1349 * The lowercase case filename of the current script without extension
Note: See TracChangeset
for help on using the changeset viewer.