changed sql statement
This commit is contained in:
@@ -6,7 +6,7 @@ class DataHandler
|
|||||||
{
|
{
|
||||||
public function registerUser($data)
|
public function registerUser($data)
|
||||||
{
|
{
|
||||||
$username = testinput($data->username);
|
$username = testinput($data->email);
|
||||||
$password = testinput($data->password);
|
$password = testinput($data->password);
|
||||||
$email = testinput($data->email);
|
$email = testinput($data->email);
|
||||||
$phone = testinput($data->phone);
|
$phone = testinput($data->phone);
|
||||||
@@ -17,12 +17,13 @@ class DataHandler
|
|||||||
$streetnumber = testinput($data->streetnumber);
|
$streetnumber = testinput($data->streetnumber);
|
||||||
$postalcode = testinput($data->postalcode);
|
$postalcode = testinput($data->postalcode);
|
||||||
$country = testinput($data->country);
|
$country = testinput($data->country);
|
||||||
|
$role = "customer";
|
||||||
|
|
||||||
$password = password_hash($password, PASSWORD_DEFAULT);
|
$password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
require($_SERVER['DOCUMENT_ROOT'] . '/config/setupDBAccess.php');
|
require($_SERVER['DOCUMENT_ROOT'] . '/config/setupDBAccess.php');
|
||||||
|
|
||||||
$sql = "INSERT INTO user (username, password, email, phone, salutation, firstname, lastname) VALUES (?,?,?,?,?,?,?)";
|
$sql = "INSERT INTO `user` (`user_id`, `username`, `password`, `email`, `phone`, `salutation`, `firstname`, `lastname`, `role`, `created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)";
|
||||||
$sql2 = "INSERT IGNORE INTO cities (postalcode, name) VALUES (?,?)";
|
$sql2 = "INSERT IGNORE INTO cities (postalcode, name) VALUES (?,?)";
|
||||||
$sql3 = "INSERT INTO address (street, streetnumber, postalcode, country) VALUES (?,?,?,?)";
|
$sql3 = "INSERT INTO address (street, streetnumber, postalcode, country) VALUES (?,?,?,?)";
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ class DataHandler
|
|||||||
$stmtCities = $db->prepare($sql2);
|
$stmtCities = $db->prepare($sql2);
|
||||||
$stmtAddress = $db->prepare($sql3);
|
$stmtAddress = $db->prepare($sql3);
|
||||||
|
|
||||||
$stmtUser->bind_param("sssssss", $username, $password, $email, $phone, $salutation, $firstname, $lastname);
|
$stmtUser->bind_param("ssssssssss",null, $username, $password, $email, $phone, $salutation, $firstname, $lastname, $role, null);
|
||||||
$stmtCities->bind_param("ss", $postalcode, $country);
|
$stmtCities->bind_param("ss", $postalcode, $country);
|
||||||
$stmtAddress->bind_param("ssss", $street, $streetnumber, $postalcode, $country);
|
$stmtAddress->bind_param("ssss", $street, $streetnumber, $postalcode, $country);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user