title: Delete PHP MySQL Query Error
body: <p>I am currently having trouble deleted a photo from my database after a user uploads it.</p>
  
  <p>This is my index file.</p>
  
  <pre><code>case "delete":
  delete((int)$_POST['IdPhoto']);
  break;
  </code></pre>
  
  <p>This is my API file (Trying to delete photo with specific ID for testing):</p>
  
  <pre><code>function delete($IdPhoto) {
  
  $result = query("DELETE from photos WHERE IdPhoto='28'");
  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');
  }
  </code></pre>
  
  <p>}</p>
  
  <p>That works perfectly. <strong>How would I do it for any ID though or a specific one that I would grab through my iOS application?</strong> </p>
  
  <p>The application grabs IdPhoto, ID, Title automatically when it loads the image. I just need the proper query to determine it by the specific ID.</p>
  
  <p>If it helps, this is how I load images:</p>
  
  <pre><code>    // load the last 50 photos from the "photos" table, also join the "login" so that you can fetch the 
      // usernames of the photos' authors
      $result = query("SELECT IdPhoto, title, l.IdUser, username FROM photos p JOIN login l ON (l.IdUser = p.IdUser) ORDER BY IdPhoto DESC LIMIT 50");
  </code></pre>