fork download
  1. <?
  2. $login = 1;
  3. $password = 1;
  4. $email = 1;
  5. $firstname = 1;
  6. $secondame =1;
  7. $age = 1;
  8. $conect = new mysqli("127.0.0.1", "root", "", "test");
  9. if ($conect->connect_errno) {
  10. echo "Не удалось подключиться к БД: $mysqli->connect_errno $mysqli->connect_error";
  11. }
  12. $usersTable = 'CREATE TABLE IF NOT EXISTS `users` (
  13. `id` INT(11) NOT NULL AUTO_INCREMENT,
  14. `login` CHAR(55) NOT NULL,
  15. `password` CHAR(55) NOT NULL,
  16. `email` CHAR(55) NOT NULL,
  17. `secondame` CHAR(55) NOT NULL,
  18. `firstname` CHAR(55) NOT NULL,
  19. `age` CHAR(55) NOT NULL,
  20. PRIMARY KEY(`id`))';
  21. if (!$conect->query($usersTable)) {
  22. echo "Не удалось создать таблицу: (" . $conect->errno . ") " . $conect->error;
  23. }
  24. if (!($stmt = $conect->prepare("INSERT INTO users(login, password, email, secondame, firstname, age) VALUES (?, ?, ?, ?, ?, ?)"))) {
  25. echo "Не удалось подготовить запрос: (" . $mysqli->errno . ") " . $mysqli->error;
  26. }
  27. if (!$stmt->bind_param("ssssss", $login, $password, $email, $secondame, $firstname, $age)) {
  28. echo "Не удалось привязать параметры: (" . $stmt->errno . ") " . $stmt->error;
  29. }
  30.  
  31. if (!$stmt->execute()) {
  32. echo "Не удалось выполнить запрос: (" . $stmt->errno . ") " . $stmt->error;
  33. }
Runtime error #stdin #stdout #stderr 0.02s 52472KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Parse error:  syntax error, unexpected '<' in /home/dxAupK/prog.php on line 3