The bottom line is that the table has such a function , add and remove columns and therefore I do not know in advance how many columns
I need to update . And now I ran into a problem . Please explain, friends.
$value is an array that takes the values that we insert into the table. convert it to int and everything works
there is an array of $columnnames in which all the columns of the table are located
the $column variable takes a value from the $columnnames array
the query should have the column name instead of the $column variable
there may be some problem with types, but the $column variable has a string type.
if $column = ‘id’ then everything works
the code below does not work
$mysqli = new mysqli("localhost", "root", "root", "college");
$table = 'astronom';
$table = $mysqli->real_escape_string($table);
$column =$columnnames[1];
$value = (int)$value[1];
$sql = mysqli_query($mysqli, "UPDATE `{$table}`
SET `{$column}` = $value
WHERE `Студенческий`={$_GET['red_id']} ");
if ($sql) {
echo '<p>Успешно!</p>';
} else {
echo '<p>Произошла ошибка: ' . mysqli_error($mysqli) . '</p>';
}