Answer the question
In order to leave comments, you need to log in
Doodles are entered into the database, what should I do?
There is a form that sends data to the database (mysql), but is saved as a scribble, what should I do?
if (isset($data['btn-reg-in'])) {
$name = $data['name'];
$familyname = $data['familyname'];
$day = $data['day'];
$month = $data['mes'];
$year = $data['year'];
$gender = $data['gender'];
$login = $data['hide'];
mysqli_query($link, "UPDATE `users` SET `name`='$name',`familyname`='$familyname',`day`='$day',`month`='$month',`year`='$year',`gender`='$gender' WHERE `login` = '$login'");
$_SESSION['login']=$login;
header("Location: /im");}?>
<?php
if(isset ($_SESSION['login'])){
header("Location : /im");
exit();
}
$host = 'localhost'; // Хост, у нас все локально
$user = 'admin'; // Имя созданного вами пользователя
$pass = 'тут пароль который есть'; // Установленный вами пароль пользователю
$db_name = 'msg'; // Имя базы данных
$link = mysqli_connect($host, $user, $pass, $db_name); // Соединяемся с базой
// Ругаемся, если соединение установить не удалось
if (!$link) {
echo 'Не могу соединиться с БД. Код ошибки: ' . mysqli_connect_errno() . ', ошибка: ' . mysqli_connect_error();
exit;
}
session_start();
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question