Reputation: 23
The problem here is I can't get a designated "id" when I tried to update a row table.
<?php
if(isset($_POST['btn-input'])){
$username = $_POST['username'];
$name = $_POST['farmername'];
$numofchicks = $_POST['numofchicks'];
$price = $_POST['price'];
$weight = $_POST['weight'];
$get_id = $_GET['get_id'];
//Outgoing
mysqli_query($dbconn, "INSERT INTO chickens_out(username, farmername, numofchicks, price, weight) VALUES('{$username}','{$name}', '{$numofchicks}', '{$price}', '{$weight}')");
mysqli_query($dbconn, "UPDATE chickens_out SET price = price * $weight * $numofchicks WHERE id = '$get_id'");
}
Upvotes: 0
Views: 33
Reputation: 11830
Why all have $_POST and it has $get_id = $_GET['get_id'];.
Should it be :
$get_id = $_POST['get_id'];
Upvotes: 1