I am trying to delete a specific entry in my MYSQL Database.
Database: PhotoID, IDCount, UserID.
This is my code for deleting a photo depending on the ID.
function delete($IdPhoto) {
$result = query("DELETE from photos WHERE IdPhoto='%d'", $IdPhoto);
if (!$result['error']) {
// if no error occured, print out the JSON data of the
// fetched photo data
print json_encode($result);
} else {
//there was an error, print out to the iPhone app
errorJson('Photo stream is broken');
}
}
This is paired with an iOS Application that grabs the current photos ID at all times. When a button is pressed, the delete function in the API will trigger. This doesn't seem to work though.
The following query works (specific ID):
$result = query("DELETE from photos WHERE IdPhoto=10");
Any help would be appreciated. The goal is to delete the photo depending on the $IdPhoto we grab in the iOS Application.