<?php // Create connection $start = microtime(TRUE); error_log('Connecting'); $connection=mysqli_connect("localhost","******","*****","*****"); error_log('Connection took' . microtime(TRUE) - $start); // Check connection if ($connection == false) { die("ERROR: Could not connect. " .mysqli_connect_error()); } // This SQL statement selects ALL from the table 'Locations' $sql = "SELECT * FROM Notes"; error_log('Running select'); if ($result = mysqli_query($connection, $sql)){ error_log('Select took' . microtime(TRUE) - $start); // If so, then create a results array and a temporary one // to hold the data $resultArray = array(); // Loop through each row in the result set error_log('looping fetch'); while($row = $result->fetch_object()) { error_log('Fetch is running at ' . microtime(TRUE) - $start); // Add each row into our results array $resultArray[] = $row; } // Finally, encode the array to JSON and output the results echo json_encode($resultArray); } error_log('Fetch is done at ' . microtime(TRUE) - $start); // Close connections mysqli_close($connection); error_log('Connection closed at ' . microtime(TRUE) - $start); ?>
You have javascript disabled. You will not be able to edit any code.