php - Changing multiple variable using same ID in SQL

<?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. Withoutusage = 0
in$sql
line everything just works fine.
Hereby, usage type isvarchar(15) NOT NULL
. Since purpose of usingusage
is to check the status of the service which I am planning to test wherebyusage = 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?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: installation failed, reverting ./composer.json and ./composer.lock to their original content
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.