see the attached

Kunika Saxena Section - 002 Travel Website Homework 8 Table of Contents Introduction ................................ ................................ ................................ ................................ ..... 1 Complete Functionality ................................ ................................ ................................ ................... 1 The code ................................ ................................ ................................ ................................ .......... 2 Installation Issues ................................ ................................ ................................ ............................ 4 Running Head: TRAVEL WEBSITE HOMEWORK EIGHT 1 Introduction This article explains the get api by reading data from a database. The data read is about tourism attraction sites in America and Canada. The data shows the common sites in these countries and the state/city they are in. W ill use MySQL as a database, PHP MySQLi as our middleware and HTML and CSS as our front -end technology. I decided to use PHP and MySQL because they are powerful technologies and power most websites because of WordPress technology, and I were also not limited to ReactJS and NodeJS. Complete Functionality The following screenshot shows the complete functionality of our common sites page. The page shows common tourist attraction sites found in the United States and Canada. The page shows a table which acts as the frontend and it provides a visually appealing interface and human readable data to the users. Running Head: TRAVEL WEBSITE HOMEWORK EIGHT 2 The code I created a database in MySQL and inserted our data in a table called “traveltbl”. The following screenshot shows our data in the database. The database is our backend, and I will connect the ba ckend with the frontend using PHP Application Programming Interface. Running Head: TRAVEL WEBSITE HOMEWORK EIGHT 3 The following is our PHP code . The code serves as the middleware where it connects the fron tend with the database and the data in the table. <?php $servername = "localhost" ; $username = "root" ; $password = ""; $dbname = "travelwebsite" ; $conn = mysqli_connect ($servername , $username , $password , $dbname ); if(!$conn ) { die ("Connection to database was not successful: " . mysqli_connect_error ()); } $sql = "SELECT * FROM traveltbl" ; $result = mysqli_query ($conn , $sql ); Running Head: TRAVEL WEBSITE HOMEWORK EIGHT 4 if(mysqli_num_rows ($result ) > 0) { while ($row = mysqli_fetch_assoc ($result )) { $id = $row ["id" ]; $site = $row ["site" ]; $city = $row ["city" ]; $country = $row ["country" ]; echo '' .$id .' ' .$site .' ' .$city .' ' .$country .' ' ; } } else { echo " No results" ; } ?> Installation Issues There were no installation issues since I had to install a sing le software known as XAMPP and it constitutes of PHP, MySQL server, and the Apache server used to host websites. The following screenshot shows the server with Apache and MySQL servers started. Running Head: TRAVEL WEBSITE HOMEWORK EIGHT 5