0

I need to include the following sql code after the "echo 'You have successfully registered, you can now login!';" how can i do this?


CREATE DATABASE IF NOT EXISTS `$username` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `$username`;

CREATE TABLE IF NOT EXISTS `diario` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `data` varchar(255) NOT NULL,
    `materia` varchar(255) NOT NULL,
    `compiti` varchar(255) NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

INSERT INTO `diario` (`id`, `data`, `materia`, `compiti`) VALUES (1, '00/00/0000', 'Informatica', 'Benvenuto')

if ($stmt = $con->prepare('INSERT INTO accounts (username, password, email) VALUES (?, ?, ?)')) {
    $password = password_hash($_POST['password'], PASSWORD_DEFAULT);
    $stmt->bind_param('sss', $_POST['username'], $password, $_POST['email']);
    $stmt->execute();
    echo 'You have successfully registered, you can now login!';
}
Nigel Ren
  • 56,122
  • 11
  • 43
  • 55
Vincenzo
  • 1
  • 1

0 Answers0