php - Changing multiple variable using same ID in SQLGet the solution ↓↓↓
<?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?
People are also looking for solutions of the problem: apache/2.4.52 (win64) openssl/1.1.1m php/8.1.2 server at localhost port 80
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.
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.