Tags down


php update query not working

By : marc571a
Date : May 03 2020, 07:47 AM

I want to change status_data_user to be nonactive from active but it cannot works fine..

on my other delete codes is working without any problems .

I've been changing it to

$hapus = mysqli_query($conn, "UPDATE tb_user SET status_data_user='$status_data_user',created_at='$created_at', updated_at='$updated_at' WHERE id_user='$id_user'");
$x="UPDATE tb_user SET status_data_user='$status_data_user',created_at='$created_at', updated_at='$updated_at' WHERE id_user='$id_user'";
$hapus = mysqli_query($conn, $x);
Answer :

The issue is that you are using the php variables in the string itself, as it will be interprated by PHP as char values but not Variables.

So try use code  like :

"UPDATE tb_user SET 
updated_at='".$updated_at."' WHERE id_user='".$id_user."'";

The method you are try to using by putting variables in string is often used in PHP Laravel Framework, because it has Blade extensions that can interpret variables within the text.

Hope it helps you :

Share : facebook icon twitter icon
Related Posts Related Posts :
  • clear array after form submit
  • pass url variable to javascript
  • access data using api
  • div position fixed css
  • add horizontal line between two div
  • disable toggle button css
  • css fixed line height
  • background image not working
  • table cell border
  • text line break css
  • overlay div on div
  • text direction rtl css
  • javascript convert string to an object
  • bind inner div click to outer div
  • jquery ajax oncomplete
  • how to use promise in for loop
  • jquery get element using variable
  • javascript send textbox value
  • pass div class content to another class or id
  • css new line after element
  • css calc not working properly
  • link disabled jquery
  • sql join table to subquery
  • MS Access SQL Issue with OR AND Operators
  • set textarea value using php
  • php merge two arrays into one
  • php form with google captcha
  • update current row in php
  • php date format mysql
  • mysql pdo select query
  • php function return an array
  • PHP mysqldump database to sql file
  • display image query
  • php create array using foreach loop
  • associative array php
  • group_concat in mysql laravel
  • php array_push empty
  • mysql on update cascade not working
  • pdo insert prepared statement
  • mysql insert ignore vs on duplicate key
  • mysql insert into existing row
  • mysql multi insert query
  • mysql group by show all rows
  • php change profile image
  • combine multiple arrays into one array php
  • how to sum values in an array
  • how to get sum of the total time
  • How to Create Facebook live stream without notification using API ?
  • on button click make div visible
  • css affect another element on hover
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org