I’m trying to update a field where username = $username
UPDATE userinfo SET password = $newpass WHERE username = $username
However, I’m getting the error “#1054 – Unknown column ‘bob’ in ‘where clause'” when I replace $username with bob.
Any idea how to correctly write this?
Aha! After your comment, it’s clear that you’re not wrapping text in quotes:
Since
$usernameis a text value, you need to put single quotes around it so that SQL parses it as text, not as a column.