php - Delete Specific MySQL Database Entry -


i trying delete specific entry in mysql database.

database: photoid, idcount, userid.

this code deleting photo depending on id.

function delete($idphoto) {  $result = query("delete photos idphoto='%d'", $idphoto); if (!$result['error']) {     // if no error occured, print out json data of      // fetched photo data     print json_encode($result); } else {     //there error, print out iphone app     errorjson('photo stream broken'); } } 

this paired ios application grabs current photos id @ times. when button pressed, delete function in api trigger. doesn't seem work though.

the following query works (specific id):

    $result = query("delete photos idphoto=10"); 

any appreciated. goal delete photo depending on $idphoto grab in ios application.

try this:

$result = query("delete photos idphoto={$idphoto}"); 

Comments