<?php
$host = "MY_HOST";
$username = "MY_USERNAME";
$password = "MY_PASSWORD";
$connection = mysqli_connect($host, $username, $password);
if(!$connection)
die("TRY AGAIN: " . mysqli_error());
$DBQuery = "USE MY_DB";
mysqli_query($connection, $DBQuery);
$queryResult = $connection->
query("SELECT * FROM MY_TABLE");
$result = array();
while ($fetchdata=$queryResult->fetch_assoc()) {
$result[] = $fetchdata;
}
echo json_encode($result);
?>
When i go to localhost/FILE_PATH/fetch.php I get the full data in JSON form
When i upload it on server and go to https://www/MYSITE.com/FILE_PATH/fetch.php I get the message TRY AGAIN:
Is there something im missing out while trying to retrieve message from server? Im using aws rds mysql
Ive put my file inside var/www/html of my server. Am i supposed to put it in htdocs or something? if so, how do i reference to the file