public static function LoadByIdContestEntry($intidFormAnswer)
 {
     $sql = sprintf("SELECT * FROM %s WHERE idContestEntry = %s;", self::TABLE_NAME, $intidFormAnswer);
     $result = LoadDriver::query($sql);
     $coll = new BaseEntityCollection();
     while ($data = mysql_fetch_assoc($result)) {
         $tObj = new ContestFormAnswer();
         $tObj->materilize($data);
         $coll->addItem($tObj);
     }
     return $coll;
 }
 public static function LoadAll()
 {
     $sql = sprintf("SELECT * FROM %s;", self::TABLE_NAME);
     $result = LoadDriver::query($sql);
     $coll = new BaseEntityCollection();
     while ($data = mysql_fetch_assoc($result)) {
         $tObj = new Attachment();
         $tObj->materilize($data);
         $coll->addItem($tObj);
     }
     return $coll;
 }
 public static function LoadByFbuid($strFbuid)
 {
     $sql = sprintf("SELECT * FROM %s WHERE fbuid = %s %s;", self::TABLE_NAME, $strFbuid, $str);
     $result = LoadDriver::query($sql);
     $coll = new BaseEntityCollection();
     while ($data = mysql_fetch_assoc($result)) {
         $tObj = new ContestFormFieldType();
         $tObj->materilize($data);
         $coll->addItem($tObj);
     }
     return $coll;
 }
 public static function delete($table, $conditions)
 {
     $where = array();
     foreach ($conditions as $field => $val) {
         if (!is_numeric($val)) {
             $val = "'" . mysql_escape_string($val) . "'";
         }
         $where[] = $field . " = " . $val;
     }
     $sql = " DELETE FROM " . $table;
     $sql .= " WHERE ";
     $sql .= join('AND ', $where);
     $sql .= ";";
     $result = LoadDriver::query($sql);
     return $result;
 }
 public static function LoadAll($blnIncludeArchived = false)
 {
     if ($blnIncludeArchived === false) {
         $strExtra = ' WHERE delDate IS NULL';
     } elseif ($blnIncludeArchived === true) {
         $strExtra = ' WHERE delDate IS NOT NULL';
     } elseif (is_null($blnIncludeArchived)) {
         $strExtra = '';
     }
     $sql = sprintf("SELECT * FROM %s %s;", self::TABLE_NAME, $strExtra);
     $result = LoadDriver::query($sql);
     $coll = new BaseEntityCollection();
     while ($data = mysql_fetch_assoc($result)) {
         $tObj = new ContestEntry();
         $tObj->materilize($data);
         $coll->addItem($tObj);
     }
     return $coll;
 }
 public static function getNextId($table, $pKey)
 {
     $sql = "SELECT MAX(" . $pKey . ") + 1 as 'id' FROM " . $table . " LIMIT 1;";
     $result = LoadDriver::query($sql);
     if ($result) {
         while ($row = mysql_fetch_assoc($result)) {
             $id = $row['id'];
             if (is_null($id)) {
                 return 1;
             } else {
                 return $id;
             }
         }
     }
 }