Example #1
0
 private static function fetchFromSqlMultiple($sql)
 {
     global $logger;
     $logger->LogDebug(__METHOD__ . " line: " . __LINE__);
     $logger->LogDebug("Fetching multiple " . __CLASS__ . " objects for SQL: " . $sql);
     if ($sql == null) {
         $logger->LogDebug("SQL is null!");
         return null;
     }
     Client::$staticErrors = array();
     $clients = array();
     $query = mysql_query($sql);
     if (!$query) {
         $logger->LogError("Error executing query!");
         $logger->LogFatal("Database error: " . mysql_errno() . ". Message: " . mysql_error());
         die("There was an error connecting to the database. Please try your request again or contact the system administrator.");
     }
     while ($row = mysql_fetch_assoc($query)) {
         $client = Client::fetchFromParameters($row);
         $clients[] = $client;
     }
     $logger->LogDebug("Fetched " . count($clients) . " clients.");
     return $clients;
 }