<?
$login = 1;
$password = 1;
$email = 1;
$firstname = 1;
$secondame =1;
$age = 1;
$conect = new mysqli("127.0.0.1", "root", "", "test");
if ($conect->connect_errno) {
echo "Не удалось подключиться к БД: $mysqli->connect_errno $mysqli->connect_error";
}
$usersTable = 'CREATE TABLE IF NOT EXISTS `users` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`login` CHAR(55) NOT NULL,
`password` CHAR(55) NOT NULL,
`email` CHAR(55) NOT NULL,
`secondame` CHAR(55) NOT NULL,
`firstname` CHAR(55) NOT NULL,
`age` CHAR(55) NOT NULL,
PRIMARY KEY(`id`))';
if (!$conect->query($usersTable)) {
echo "Не удалось создать таблицу: (" . $conect->errno . ") " . $conect->error;
}
if (!($stmt = $conect->prepare("INSERT INTO users(login, password, email, secondame, firstname, age) VALUES (?, ?, ?, ?, ?, ?)"))) {
echo "Не удалось подготовить запрос: (" . $mysqli->errno . ") " . $mysqli->error;
}
if (!$stmt->bind_param("ssssss", $login, $password, $email, $secondame, $firstname, $age)) {
echo "Не удалось привязать параметры: (" . $stmt->errno . ") " . $stmt->error;
}
if (!$stmt->execute()) {
echo "Не удалось выполнить запрос: (" . $stmt->errno . ") " . $stmt->error;
}
PD8KJGxvZ2luID0gMTsKJHBhc3N3b3JkID0gMTsKJGVtYWlsID0gMTsKJGZpcnN0bmFtZSA9IDE7CiRzZWNvbmRhbWUgPTE7CiRhZ2UgPSAxOwokY29uZWN0ID0gbmV3IG15c3FsaSgiMTI3LjAuMC4xIiwgInJvb3QiLCAiIiwgInRlc3QiKTsKaWYgKCRjb25lY3QtPmNvbm5lY3RfZXJybm8pIHsKICAgIGVjaG8gItCd0LUg0YPQtNCw0LvQvtGB0Ywg0L/QvtC00LrQu9GO0YfQuNGC0YzRgdGPINC6INCR0JQ6ICRteXNxbGktPmNvbm5lY3RfZXJybm8gJG15c3FsaS0+Y29ubmVjdF9lcnJvciI7Cn0KJHVzZXJzVGFibGUgPSAnQ1JFQVRFIFRBQkxFIElGIE5PV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