1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?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);
-
- $FindUID=$decodedData["FindUID"];
-
- $query= "SELECT UID, acc_type, name, email, phone_num from users";
- $stmt=mysqli_prepare($connection, $query);
- mysqli_stmt_execute($stmt);
-
- mysqli_stmt_bind_result($stmt, $uid, $acc_type, $name, $email, $phone);
-
- while(mysqli_stmt_fetch($stmt)){
-
- $response[] = array("id"=>$uid, "accountType"=>$acc_type, "name"=> $name, "email"=> $email, "phone"=>$phone);
-
- }
-
- // if(mysqli_num_rows($stmt)>0)
- // {
- // $Row = mysqli_fetch_assoc($stmt);
- // $eid = $Row['eid'];
- // $name = $Row['name'];
- // $start_date = $Row['start_date'];
- // $end_date = $Row['end_date'];
- // $participant_count = $Row['participant_count'];
- // $participant_limit = $Row['participant_limit'];
- // $description = $Row['description'];
- // }
- // else
- // {
- // $eid = "";
- // $name = "";
- // $start_date = "";
- // $end_date = "";
- // $participant_count = "";
- // $participant_limit = "";
- // $description = "";
- // }
-
-
- // ----------------------------------------------
- // $eid = '1';
- // $name = 'testEvent';
- // $start_date = '2023-01-07';
- // $end_date = '2023-01-23';
- // $participant_count = '13';
- // $participant_limit = '20';
- // $description = 'TEST TEST TEST TEST TEST TEST TEST TEST';
- //-----------------------------------------------
-
- // $response[] = array("eid"=>$eid, "name"=>$name, "Sdate"=>$start_date, "Edate"=>$end_date, "Pcount"=>$participant_count, "Plimit"=>$participant_limit, "description"=>$description);
- echo json_encode($response);
- // $TPMGJson = json_encode($response);
- // file_put_contents('./events.json', $TPMGJson);
- // echo $TPMGJson;
-
- ?>
|