async mounted() {
let app_location = this;
var newLocation = app_location;
await axios.get('/api/locations/' + app_location.$route.params.id, newLocation)
.then(function (resp) {
app_location.locations = resp.data;
})
},
$sql = "UPDATE Products
SET
prices_purchase= :prices_purchase,
prices_selling= :prices_selling,
prices_discount= :prices_discount
WHERE product_id= :product_id
AND region= :region
";
// подготовка запроса
$update = $this->bd_connect->prepare($sql);
// привязываем значения
$update->bindParam(':product_id',$p_id);
$update->bindParam(':region',$key);
$update->bindParam(':prices_purchase',$p_purchase);
$update->bindParam(':prices_selling',$p_selling);
$update->bindParam(':prices_discount',$p_discount);
//Выполняем запрос
$update->execute()
//Узнаем сколько строк затронул запрос
$count = $update->rowCount();
if ($count==0){
$sql = "INSERT INTO Products
SET
product_id= :product_id,
region= :region,
prices_purchase= :prices_purchase,
prices_selling= :prices_selling,
prices_discount= :prices_discount
";
// подготовка запроса
$stmt = $this->bd_connect->prepare($sql);
// привязываем значения
$stmt->bindParam(':product_id',$p_id);
$stmt->bindParam(':region',$key);
$stmt->bindParam(':prices_purchase',$p_purchase);
$stmt->bindParam(':prices_selling',$p_selling);
$stmt->bindParam(':prices_discount',$p_discount);
//Выполняем запрос
$stmt->execute()
}