Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Access-Control-Allow-Origin: *');
- header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
- header('Access-Control-Allow-Credentials: true');
- header('Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept');
- header('Content-Type: application/json, charset=UTF-8');
- $hostname = "localhost:3306";
- $database = "Website_execrise";
- $username = "Website";
- $password = "6y805maCvrfZS65p";
- $conn = isset($conn) ? $conn : mysqli_connect($hostname, $username, $password, $database) or die("Failed: " . mysqli_connect_error());
- $arr = array();
- $result = mysqli_query($conn,"SELECT * FROM CLUB");
- $num = mysqli_num_rows($result);
- if ($num > 0) {
- while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) {
- $arr2 = array('familyname'=>$row['familyname'],'givenname'=>$row['givenname']
- ,'sex'=>$row['sex'],'phone'=>$row['phone'],'sport'=>$row['sport'],'level'=>$row['level']);
- array_push($arr,$arr2);
- }
- }
- echo json_encode($arr);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement