登録データをデータベースに挿入する登録ページがあります。これは次のようになります。
if ($_POST['password'] == $_POST['conf_pass']){
$user = $_POST['username'];
$pass = $_POST['password'];
$hash = md5(rand(0,1000));
$accres = mysqli_query($connection, "INSERT INTO accounts (street1, suburb, city, postcode, username) VALUES($address, $suburb, $city, $postcode, $username)");
$account_id = mysqli_insert_id($accres);
$peopleres = mysqli_query($connection, "INSERT INTO people (lastname, firstname, accounts_id, birthdate, phonenumber, username, password, email, hash) VALUES($lastname, $firstname, $account_id, $birthdate, $phonenumber, $username, $password, $email, $hash)");
$peoplerows=mysqli_fetch_assoc($peopleres);
$person_id=$peoplerows[0];
mysqli_query("INSERT INTO PeopleToRole (role_id) VALUES(1)");
$email = $_SESSION['email'];
$p->addContent("User Registered");
}
私は当初、postgres を使用してこれらすべてをプログラムしましたが (Apache サーバーでローカルにホストされていました)、ホスト Web サイトが既に mysqli で動作していたため、mysqli に変更する必要がありました。
したがって、このコードはページに登録されたユーザーを返すため、if ステートメントは機能しています。しかし、何らかの理由で、insert ステートメントはデータベースに何も挿入しません。
ある種のフォーマットエラーがありますか? または私が逃した小さな何か?ありとあらゆる助けをいただければ幸いです。ありがとう