C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
PHP MySQL Update RecordPHP mysql_query() function is used to update record in a table. Since PHP 5.5, mysql_query() function is deprecated. Now it is recommended to use one of the 2 alternatives.
PHP MySQLi Update Record ExampleExample'; $id=2; $name="Rahul"; $salary=80000; $sql = "update emp4 set name=\"$name\", salary=$salary where id=$id"; if(mysqli_query($conn, $sql)){ echo "Record updated successfully"; }else{ echo "Could not update record: ". mysqli_error($conn); } mysqli_close($conn); ?> Output: Connected successfully Record updated successfully
Next TopicPHP MySQL Delete Record
|