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]);