Answer the question
In order to leave comments, you need to log in
How to change data from sql database by seeing the data?
Hello everyone, here is the code:
if(isset($_POST['save'])) {
$sql = "UPDATE `users` SET
`qyes` = '".mysqli_real_escape_string($link, $_POST['qyes'])."',
`answer` = '".mysqli_real_escape_string($link, $_POST['answer'])."',
`value` = '".mysqli_real_escape_string($link, $_POST['value'])."',
`status` = '".mysqli_real_escape_string($link, $_POST['status'])."'
WHERE `id` = '".$_POST['id']."';";
if(mysqli_query($link, $sql)) {
$info = "Сохранено";
}
}
Answer the question
In order to leave comments, you need to log in
Usually use ORM. Simply put, an object that represents a record in a table.
First, it is loaded from the database: and shown in the form:$record = User::find(123);
return view('user-form', ['user' => $record->toArray()]);
id
edited record, and under it save the received data. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question