I have a piece of code where I use MYSQL to add records into a database. Here I use INSERT, but I want to work with UPDATE.
The user selects records which have to be updated. The records have a unique number.
I hope people can help me how to convert MYSQL code into PHP.
The MYSQL code used in the console is this:
UPDATE table_name SET input2='my input here ' WHERE rec_number = 2;
The part of the script I use looks like this:
<?php
$name1 = $conn->real_escape_string($input1);
$name2 = $conn->real_escape_string($input2);
// $sql = "INSERT INTO $table (input1, input2 ) VALUES (' $name1 ', ' $name2 ')" ; // olde code
// $sql = "UPDATE $table SET input2, input1 WHERE rec_number = $rec_number_selected VALUES (' $name1 ', ' $name2 ')" ;
$sql = "UPDATE $table (input1, input2) VALUE S (' $name1 ', ' $name2 ') WHERE rec_number = $rec_number_selected " ;
?>
Anyone any idea what the right code is in PHP?