I have a MySQL database/table set up and a .php file online that inserts data into the mysql database. My php code is here:
<?
$name = $_GET['name'];
$minScore = $_GET['minScore'];
$hourScore = $_GET['hourScore'];
$dayScore = $_GET['dayScore'];
$service = "dddd.com";
$username = "dddd";
$password = "dddd";
$database = "dddd_DATA1";
mysql_connect($service, $username, $password);
@mysql_select_db($database) or die( "Unable to select database");
if($minScore>0) {
$query="INSERT INTO currentScores VALUES ('$name', '$minScore', '$hourScore','$dayScore',null)";
$result=mysql_query($query);
echo("Score submitted! Name: $name, Score: $minScore");
}
else {
echo("No score was submitted");
}
?>
It works the way I want it to typing a URL link like this right in a browser: http://dddd.com/sendScores.php?name=NAMEYNAME&minScore=22&hourScore=3&dayScore=1
What I want to do now is somehow send this from my iPhone objective-c app. I assume I need to use NSURLRequests and NSURLConnections but I have been unable to get it to work so far. How can I do this? and if you have time... any ideas on how to get the info from the database back onto my app? Would I need to convert it to xml (or maybe a .plist) using php and then use an xml parser in objective-c? Thank you for your time.