Skip to content

Instantly share code, notes, and snippets.

@WoZ
Created March 12, 2012 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WoZ/6da7c9ad9719e5f3e551 to your computer and use it in GitHub Desktop.
Save WoZ/6da7c9ad9719e5f3e551 to your computer and use it in GitHub Desktop.
<?php
// ...
$key = 'some string';
if ($result = MDBObject::query($query)) {
$returnList = array();
if (mysql_num_rows($result) > 0) {
while ($obj = mysql_fetch_object($result)) {
$id = $obj->$key;
unset($obj->$key);
$returnList[$id] = $obj;
}
}
mysql_free_result($result);
}
// ...
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment