You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
507 B

<?php
require_once("../conn.php");
$model = $_GET['model'];
$kind = $_GET['kind'];
$sql_str = "SELECT id, model, price FROM facility_price WHERE model = :model AND kind = :kind ORDER BY id DESC";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':model', $model);
$stmt->bindParam(':kind', $kind);
$stmt->execute();
$el = $stmt->fetch(PDO::FETCH_ASSOC);
if($el){
$price = $el['price'];
$id = $el['id'];
}else{
$price = null;
$id = null;
}
echo json_encode(['id'=>$id, 'price'=>$price]);