<?php
$conn = mysqli_connect("localhost", "root", "password");
mysqli_select_db($conn, "stiry");
$sql = "UPDATE system SET ad = '".$_POST['ad']."', ph = '".$_POST['ph']."' , usage = 0 WHERE id = 1";
$result = mysqli_query($conn, $sql);
?>
I have understand that I have to use comma in order to update multiple variables at the same time. My goal is to update ad, ph and usage when user press submit button in index.php. Without usage = 0
in $sql
line everything just works fine.
Hereby, usage type is varchar(15) NOT NULL
. Since purpose of using usage
is to check the status of the service which I am planning to test whereby usage = 1
will represent that user is using my service.
In my database, usage column is recorded as 0 thus I have to change it to 1 as user press submit button.
What is the possible error here?