mysql - PHP adds one to database on refresh? -
everytime load pages adds 1 database? have button add 1 database not on refresh? ideas? reading, james.
edit: if press remove button , refresh on refresh remove 1 , same remove button click once on refresh takes 1 away no reason.
full code: https://pastebin.com/vsrzranc
$currentsales = "select `sales` `sales` `id` = 1 "; if ($result=mysqli_query($link, $currentsales)) { $row = mysqli_fetch_array($result); } //echo $row[sales]; if (isset($_post['utextbox'])) { $updatesalescutom = $_post['utbtext']; echo '<div class="udate1 alert alert-info">updating</div>'; $query = "update `sales` set `sales` = `sales` + $updatesalescutom `sales`.`id` = 1"; mysqli_query($link, $query); echo '<div class="udate2 alert alert-success">successfully updated!</div>'; } if (isset($_post['usalep1'])) { echo '<div class="udate1 alert alert-info">updating</div>'; $query = "update `sales` set `sales` = `sales` + 1 `sales`.`id` = 1"; mysqli_query($link, $query); echo '<div class="udate2 alert alert-success">successfully updated!</div>'; } if (isset($_post['usaler1'])) { echo '<div class="udate1 alert alert-info">updating</div>'; $query = "update `sales` set `sales` = `sales` - 1 `sales`.`id` = 1"; mysqli_query($link, $query); echo '<div class="udate2 alert alert-success">successfully updated!</div>'; }
Comments
Post a Comment