-3

I am trying to write code using PHP to update column for specific user in phpmyadmin my code was work in localhost (xampp) but after I upload the back end on hostinger host it not work.

Here is my code:

<?php   

include "../conect.php";
$username = filterRequest("username");
$verfiy = filterRequest("verifayCode");
$email = filterRequest("email");
$stmt = $con->prepare("SELECT * FROM users where username = '$username' AND verifayCode='$verfiy'");
$stmt->execute();

$count =$stmt->rowCount();

if($count > 0){
//$data = array("userApprove"=>"1");
$stmm = $con->prepare("UPDATE `users` SET `userApprove`=1 WHERE `email` = '$email' and `username` ='$username'");
$stmm->execute();
$c =$stmm->rowCount();
    if($c>0){
        echo json_encode(array("cont" => $c ));
        echo json_encode(array("status" => "success"));
    }else{
        echo json_encode(array("cont" => $c ));
        echo json_encode(array("status" => "faillo"));
    }

}
else{
    echo json_encode(array("cont" => $username,$count));
    echo json_encode(array("status" => "faill"));

}
?>

This is the table in phpmyadmin:

Here the column information that answers will not change from 0 to 1:

My back end code work in locale host (xampp) but in hostinger host it not work the value of userApprove column not update to 1.

ADyson
  • 57,178
  • 14
  • 51
  • 63
  • 1
    Why have you posted the same question twice?? https://stackoverflow.com/questions/76937692/i-can-not-update-on-coulmn-data-on-phpmyadmin – user3783243 Aug 20 '23 at 04:12
  • (1) Make sure that the field names in the db table match with the field names in your php code (including the case) ; (2) I noticed that you are using a `filterRequest` function to process some of the data, what is it actually ? (3) I also noticed that some of the username records contain non-English characters, please make sure that you are setting correctly the character encoding when performing SQL queries. – Ken Lee Aug 20 '23 at 06:44

0 Answers0