I am android developer and I am weak in PHP.
This one is working:
$sql = "DELETE FROM user WHERE id = '$user->id' ";
This one works too:
$sql = "DELETE FROM user WHERE email = '" . '[email protected]' . "'";
But this query not working:
$sql = "DELETE FROM user WHERE email = '" . "'$user->email'" . "'";
This is my phpMyAdmin table:
and this is my del.php api that works fine with first two query:
<?php
include_once('../common/include.php');
include_once('../common/encipher.php');
$user = json_decode(file_get_contents("php://input"));
$conn=getConnection();
if($conn==null){
sendResponse(500,$conn,'Server Connection Error !');
exit;
}
$sql = "DELETE FROM user WHERE id = '$user->id'";
$result = $conn->query($sql);
if ($conn->affected_rows > 0) {
sendResponse(200, [], 'User deleted .');
}
else
{
sendResponse(404, [], 'Error on delete !');
}
$conn->close();