You are currently binding the variables twice - once through bindParam()
, then once again as the argument to execute()
. You need to bind the variable once, either by bindParam()
or by execute()
, but not both at the same time.
Also, the syntax for deleting is DELETE FROM...
, not DELETE column FROM...
.
So it'll either look like this, binding them through execute()
$DeleteT = $con->prepare("DELETE FROM USERS WHERE Email=:Email AND Pass=:Pass");
$DeleteT->execute(array(
':Email' => $Email,
':Pass' => $Pass
));
or, if you want to use bindParam()
...
$DeleteT = $con->prepare("DELETE FROM USERS WHERE Email=:Email AND Pass=:Pass");
$DeleteT->bindParam(':Pass', $Pass);
$DeleteT->bindParam(':Email', $Email);
$DeleteT->execute();
Either is fine for this purpose, choose which one you like most. PDOStatement::bindParam()
has additional options should you need it (there's additional information on that in the documentation linked below), but for the purpose of binding two strings, either way is applicable.
Update:
As per the comments, you wish to just empty out the Examples
column. This means that you want to UPDATE
the row, not DELETE
it. The example below would set the Example
column to an empty string (assuming that it's a text or varchar column, and accept strings). If you wish to set it to NULL
or another value, modify it as such.
$DeleteT = $con->prepare("UPDATE USERS SET Examples=:example WHERE Email=:Email AND Pass=:Pass");
$DeleteT->execute(array(
':example' => '',
':Email' => $Email,
':Pass' => $Pass
));
SECURITY NOTE:
You should NEVER store passwords in plain-text, or by using poor methods of hashing (such as md5()
, sha1()
, etc). It's simply not secure! PHP has built-in functions which you should use to handle storing of passwords, see the password_hash()
function which is a lot more secure!