Esempio n. 1
0
 public function listPrice($placeApiId, $placeId)
 {
     $cn = new Conexao();
     $prices = array();
     if ($placeApiId != null && $placeId == null) {
         $sql = "SELECT id, name, description, price FROM prices_added WHERE place_api_id like '" . $placeApiId . "'";
         $result = $cn->execute($sql);
         if ($result != false) {
             while ($rs = mysql_fetch_array($result)) {
                 $price = new Price($rs["id"], $rs["name"], $rs["description"], $rs["price"], null, $placeApiId);
                 array_push($prices, $price->transformaArray());
             }
             $cn->disconnect();
             return $prices;
         } else {
             $cn->disconnect();
             return false;
         }
     } else {
         if ($placeApiId == null && $placeId != null) {
             $sql = "SELECT id, name, description, price FROM prices_added WHERE place_id = " . $placeId . "";
             $places = array();
             $result = $cn->execute($sql);
             if ($result != false) {
                 while ($rs = mysql_fetch_array($result)) {
                     $price = new Price($rs["id"], $rs["name"], $rs["description"], $rs["price"], $placeId, null);
                     array_push($prices, $price->transformaArray());
                 }
                 $cn->disconnect();
                 return $prices;
             } else {
                 $cn->disconnect();
                 return false;
             }
         }
     }
 }