1234567891011121314151617181920212223242526272829303132333435363738 |
- <?PHP
-
- // ---------------
- // Connection to server and database
- // ---------------
-
- $host = "localhost";
- $basedatos = "techos";
- $user = "pablo.puig1";
- $passw = "9NA3kSExI2fGE6eV";
-
- try{
- $connection = mysqli_connect($host, $user, $passw, $basedatos) or $error = 1;
- }
- catch(Exception $ex){
- print("Error connecting to database: ". $ex->getMessage()) and die();
- }
-
- // //---------------
- // // Query and sending results
- // //---------------
- header('Content-Type: application/json');
-
- $encodedData=file_get_contents('php://input');
- $decodedData=json_decode($encodedData, true);
-
- $addAccType=$decodedData["ACC"];
- $addName=$decodedData["name"];
- $addEmail=$decodedData["email"];
- $addPhone=$decodedData["phone"];
-
- $queryAddUser = "INSERT INTO users (acc_type, name, email, phone_num) VALUES ('$addAccType', '$addName', '$addEmail', '$addPhone')";
- mysqli_query($connection, $queryAddUser);
- // $stmtAdd = mysqli_prepare($connection, $queryAddUser);
- // mysqli_stmt_execute($stmtAdd);
-
-
- ?>
|