Veerendra Veerendra - 2 months ago 8
PHP Question

How to write update query using some {$variable} with example

How to write update query using some

{$variable}
with example
eg:

$query="update subjects set values username='{$name}', hash_password='{$pass}' where id=1";

Answer

You cannot use values there, it should be:

$query="update subjects set username='{$name}', hash_password='{$pass}' where id=1";

But I would recommend using a prepared statement instead of dumping variables straight into your query.