ErdiTAN Merhaba,
ben bir fonksiyon yazmıştım önceden.
function insertUser($user_name, $user_pass, $user_mail, $user_name_surname, $user_last_date, $user_status, $user_bio)
{
include "connection.php";
try {
$sql = "insert into users(user_name, user_pass, user_mail, user_name_surname, user_last_date, user_status, user_bio)
values(:user_name, :user_pass, :user_mail, :user_name_surname, :user_last_date, :user_status, :user_bio)";
$statement = $conn->prepare($sql);
$statement->execute([
'user_name' => $user_name,
'user_pass' => md5($user_pass),
'user_mail' => $user_mail,
'user_name_surname' => $user_name_surname,
'user_last_date' => $user_last_date,
'user_status' => $user_status,
'user_bio' => $user_bio
]);
return true;
} catch (Exception $e) {
//include "log.php";
//addLog($e->getMessage());
return false;
}
}
Bu da güncelleme örneği, umarım yardımı dokunur. Sizin kodda sanırsam tanımlamalar kompleks kullanılmış.
$sql = "update token set active = 0 where userid = :id";
$statement = $conn->prepare($sql);
$result = $statement->execute([
"id" => $userid
]);