I am trying to code a user system. I am having an issue with the activation part. I can select and insert data to my table but now I am trying to create an update statement and got stuck.
<?PHP
include "db_settings.php";
$stmt = $dbcon->prepare("UPDATE 'Kullanicilar' SET 'Aktivasyon' = ? WHERE 'KullaniciID'=?");
// execute the query
$stmt->execute(array('1','5'));
// echo a message to say the UPDATE succeeded
echo $stmt->rowCount() . " records UPDATED successfully";
?>
And I am getting error as:
"0 records UPDATED successfully".
This is my table; https://i.stack.imgur.com/0j2ta.png
I have tried by changing my 'Aktivasyon' type int
to char
but it also does not work.
EDIT: I am trying to make this a function;
function dataUpdate($tableName, $updateRow, $updateValue, $conditonRow, $conditionValue) { include "db_settings.php"; $q = $dbcon->prepare("UPDATE $tableName SET $updateRow= ? WHERE $conditonRow= ?"); $q->execute(array($updateValue,$conditionValue)); }
I also try this :
... $q = $dbcon->prepare("UPDATE `$tableName` SET `$updateRow`= ? WHERE `$conditonRow`= ?"); ...
How can I make this statement work?