Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = 'a9517348_colm';
- $password = 'parkdbpass7';
- $database = 'a9517348_parkdb';
- $host = 'mysql5.000webhost.com';
- //create connection to the database
- $con = mysqli_connect($host, $username, $password, $database);
- mysqli_select_db($con, $database)or die("cannot select DB");
- //return all event titles from the database ordered by date
- $sql = "select id, title, location, date from event_list order by id desc";
- $result = mysqli_query($con, $sql);
- $json = array();
- //get each row of data from the database
- if(mysqli_num_rows($result))
- {
- while($row = mysqli_fetch_assoc($result))
- {
- $json['event_list'][] = $row;
- }
- echo json_encode($json);
- }
- mysqli_close($con);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement