PHP/MySQL - any shorthand equivalent for PDO UPDATE?

Solution:
You can omit thebindParam
calls by putting an array of parameters in the call toexecute
:
$sth = $conn->prepare("UPDATE user SET session = :session WHERE email = :email");
$sth->execute(array(':session' => $session, ':email' => $email));
I don't like it much, but if you don't want to have to write "session" and "email" so many times, you could use positional parameters instead of named ones:
$sth = $conn->prepare("UPDATE user SET session = ? WHERE email = ?");
$sth->execute(array($session, $email));
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: trying to access array offset on value of type bool
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.