-
Notifications
You must be signed in to change notification settings - Fork 3
/
registration.php
44 lines (37 loc) · 1.71 KB
/
registration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
include "connection.php";
$sthandler = $conn->prepare("SELECT email FROM `users` WHERE email = :email");
$sthandler->bindParam(':email', $_POST['email']);
$sthandler->execute();
if($sthandler->rowCount() > 0){
echo "exists! cannot insert";
} else {
$sql = "INSERT INTO `users` ( `full_name`, `email`, `password`, `phone`,`points`, `age`, `location`, `address` , `details_manufacturing`) VALUES (
:full_name,
:email,
:password,
:phone,
:points,
:age,
:location,
:address,
:details_manufacturing)";
$statement = $conn->prepare($sql);
$statement->bindValue(':full_name', $_POST['full_name']);
$statement->bindValue(':email', $_POST['email']);
$statement->bindValue(':password', $_POST['password']);
$statement->bindValue(':phone', $_POST['phone']);
$statement->bindValue(':points', $_POST['points']);
$statement->bindValue(':age', $_POST['age']);
$statement->bindValue(':location', $_POST['location']);
$statement->bindValue(':address', $_POST['address']);
$statement->bindValue(':details_manufacturing', $_POST['details_manufacturing']);
$inserted = $statement->execute();
if($inserted){
$sth = $conn->prepare("SELECT * FROM users WHERE email = '".$_POST["email"]."' " );
$sth->execute();
$result2 = $sth->fetch(PDO::FETCH_ASSOC);
echo json_encode($result2);
}
}
?>