Exemple #1
0
 public function deleteLocationsForObject($gameId, $strObjectType, $intObjectId)
 {
     //Check the object Type is good or null
     if (!Locations::isValidObjectType($strObjectType) or !strlen($strObjectType) > 0) {
         return new returnData(4, NULL, "invalid object type");
     }
     //Delete the Locations and related QR Codes
     $query = "DELETE locations, qrcodes \n            FROM locations\n            LEFT JOIN qrcodes\n            ON locations.game_id = qrcodes.game_id AND locations.location_id = qrcodes.link_id\n            WHERE locations.type = '{$strObjectType}' AND locations.type_id = '{$intObjectId}' AND qrcodes.link_type = 'Location'";
     Module::query($query);
     if (mysql_error()) {
         return new returnData(3, NULL, "SQL Error" . mysql_error());
     }
     if (mysql_affected_rows()) {
         return new returnData(0, TRUE);
     } else {
         return new returnData(0, FALSE);
     }
 }