I'm rather new to ios and json.
I've managed to create a db in mysql and used php to create a basic read and write php pages.
I'm using the TwitterHelper class from cs193p class for the presence assignment from Stanford to acces the php interface online and tie it to my ios code. I am getting an error which I can't solve.
Update:
Ok, here is my code:
<?php
include_once("JSON.php");
$json = new Services_JSON();
$link = mysql_pconnect("localhost", "user", "pass") or die("Could not connect");
mysql_select_db("mydb") or die("Could not select database");
$query = "SELECT * FROM tags";
$result = mysql_query($query);
$arr = array();
$rs = mysql_query("SELECT * FROM tags");
while($obj = mysql_fetch_object($rs)) {
$arr[] = $obj;
}
Echo $json->encode($arr);
//Echo '{:'.$json->encode($arr).'}';
?>
The problem is that unless i remove the [] from $arr[], i get the answer to the php page enclosed in [] which the json fetch doesnt like and therefore throws and exception error and crashes my app.
If i remove it, the php page only returns 1 result...