Hey guys, on my server I´ve got a PHP file that retrieves my SQL database and encodes it to JSON:
<?php
$host = "abc"; //Your database host server
$db = "abc"; //Your database name
$user = "abc"; //Your database user
$pass = "abc"; //Your password
$connection = mysql_connect($host, $user, $pass);
//Check to see if we can connect to the server
if(!$connection)
{
die("Database server connection failed.");
}
else
{
//Attempt to select the database
$dbconnect = mysql_select_db($db, $connection);
//Check to see if we could select the database
if(!$dbconnect)
{
die("Unable to connect to the specified database!");
}
else
{
$query = "SELECT * FROM cities";
$resultset = mysql_query($query, $connection);
$records = array();
//Loop through all our records and add them to our array
while($r = mysql_fetch_assoc($resultset))
{
$records[] = $r;
}
//Output the data as JSON
echo json_encode($records);
}
}
?>Im currently developing and iOS app.. anyways.. i´ve populated my database with three objects.. so far so good.. everything works like a charm.. when i go to my php file that is online it shows correctly (as json).. but when i add more objects and update my php file that is online i only get a blank screen.. like it isn't encoding at all.. any ideas? is it just my slow internet server or could it be something else?? hope u understand what i mean :( thanks for now