depending on your php version you can json_encode () the results of your MySQL query or (as shown below) JSON.
then in your ios use a parser (I use SBJSON) and it converts JSON to an array or a dictionary (depending on how you use it) ... I did not use JSONKit, so I can not comment on this aspect
: , "", ( JSON)? JSON iOS, ?
<?php
$query = "SELECT * FROM table_name";
$result = mysql_query("$query");
echo "{\"results\":";
if($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "[";
echo "{\"field_one\":\"".$row["field_one"]."\",";
echo "\"field_two\":\"".$row["field_two"]."\",";
echo "\"field_three\":\"".$row["field_three"]."\",";
echo "\"field_four\":\"".$row["field_four"]."\"";
echo "}";
}
else{
echo "\"no\"}";
exit;
}
while($row = mysql_fetch_array($data,MYSQL_ASSOC)){
echo ",{\"field_one\":\"".$row["field_one"]."\",";
echo "\"field_two\":\"".$row["field_two"]."\",";
echo "\"field_three\":\"".$row["field_three"]."\",";
echo "\"field_four\":\"".$row["field_four"]."\"";
echo "}";
}
echo "]}";
?>