I am working to develop an Android app that stores and logs coffee shops that I go to. It is just a small personal project I have been working on for some time now. I recently changed servers and rebuilt my SQL server on it. Since then I have only been able to SELECT from one Table, the other table returns no values.
The PHP code for running the GET command is identical for both tables, the only differences being the table name and contents. The code also worked prior to the mySQL server rebuild. This leads me to believe that there is something wrong with my SQL server, which I simply imported the data from the previous server when I rebuilt it.
<?php
//DATABASE CONNECTION INFO LEFT OUT//
$connect = mysqli_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
die();
}
$stmt = $connect->prepare("
SELECT ShopID
, IconURL
, Title
, Address
, City
, State
, Zip
, Rating
FROM CoffeeShops
;");
$stmt->execute();
$stmt->bind_result($ShopID, $IconURL, $Title, $Address, $City, $State, $Zip, $Rating);
$shops = array();
while($stmt->fetch()){
$temp = array();
$temp['ShopID'] = $ShopID;
$temp['IconURL'] = $IconURL;
$temp['Title'] = $Title;
$temp['Address'] = $Address;
$temp['City'] = $City;
$temp['State'] = $State;
$temp['Zip'] = $Zip;
$temp['Rating'] = $Rating;
array_push($shops, $temp);
}
echo json_encode($shops);
mysqli_close($connect);
?>
The above code is for the Table that will not return data. The other code is identical and works just fine as mentioned above.