Changeset 25427
- Timestamp:
- Nov 10, 2013, 6:03:25 PM (10 years ago)
- Location:
- trunk/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/dblayer/functions_mysql.inc.php
r25018 r25427 201 201 */ 202 202 203 /**204 * creates an array based on a query, this function is a very common pattern205 * used here206 *207 * @param string $query208 * @param string $fieldname optional209 * @return array210 */211 function array_from_query($query, $fieldname=false)212 {213 $array = array();214 215 $result = pwg_query($query);216 if (false === $fieldname)217 {218 while ($row = mysql_fetch_assoc($result))219 {220 $array[] = $row;221 }222 }223 else224 {225 while ($row = mysql_fetch_assoc($result))226 {227 $array[] = $row[$fieldname];228 }229 }230 return $array;231 }232 233 203 define('MASS_UPDATES_SKIP_EMPTY', 1); 234 204 /** -
trunk/include/dblayer/functions_mysqli.inc.php
r25018 r25427 238 238 */ 239 239 240 /**241 * creates an array based on a query, this function is a very common pattern242 * used here243 *244 * @param string $query245 * @param string $fieldname optional246 * @return array247 */248 function array_from_query($query, $fieldname=false)249 {250 $array = array();251 252 $result = pwg_query($query);253 if (false === $fieldname)254 {255 while ($row = pwg_db_fetch_assoc($result))256 {257 $array[] = $row;258 }259 }260 else261 {262 while ($row = pwg_db_fetch_assoc($result))263 {264 $array[] = $row[$fieldname];265 }266 }267 return $array;268 }269 270 240 define('MASS_UPDATES_SKIP_EMPTY', 1); 271 241 /** -
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.