title: Amazon SQS Messages not deleting in PHP
body: <p>I list the messages in my Amazon SQS queue and then have the option to delete them, one at a time. When I delete the message I get a SUCCESS message back. However, not a single message is deleted and they all return to the queue.</p>
  
  <p>Here is the list queue code:</p>
  
  <pre><code>&lt;?php
  include_once("sdk.class.php");
  
  // Instantiate
  $sqs = new AmazonSQS();
  $rows = $sqs-&gt;get_queue_size('https://sqs.us-east-1.amazonaws.com/199992002821/SomeQueueSQS');
  
  echo "&lt;table&gt;";
  echo "&lt;tr&gt;";
  echo "&lt;td width=20 valign=top bgcolor=" . $adHeading . " align=left&gt;&lt;strong&gt;No&lt;/strong&gt;&lt;/td&gt;";
  echo "&lt;td width=200 valign=top bgcolor=" . $adHeading . " align=left&gt;&lt;strong&gt;Message&lt;/strong&gt;&lt;/td&gt;";
  echo "&lt;td width=50 align='right' bgcolor=" . $adHeading . "&gt;&lt;a href='sqs.php'&gt;&lt;img src='images/icon_refresh.png' border='0'&gt;&lt;/a&gt;&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  
  for ($j = 0; $j &lt; $rows; ++$j)
    {
  
      // Get Message
      $response = $sqs-&gt;receive_message('https://sqs.us-east-1.amazonaws.com/199992002821/SomeQueueSQS', array(
    'VisibilityTimeout' =&gt; 30
  ));
  $body = $response-&gt;body-&gt;ReceiveMessageResult-&gt;Message[0]-&gt;Body;
  $rcpt_hand=($response-&gt;body-&gt;ReceiveMessageResult-&gt;Message[0]-&gt;ReceiptHandle);
  
      $id = $j + 1;
  
      echo "&lt;tr&gt;";
      echo "&lt;td valign=top bgcolor=" . $bgcolor . "&gt;$id&lt;/td&gt;";
      echo "&lt;td valign=top bgcolor=" . $bgcolor . "&gt;$body&lt;/td&gt;";
      echo "&lt;td valign=top&gt;&lt;a href=sqsdelete.php?sid=$rcpt_hand&gt;&lt;img   src=images/icon_delete.gif border=0 width=18 height=18&gt;&lt;/a&gt;&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  
    }
  
  echo "&lt;/table&gt;";
  ?&gt;
  </code></pre>
  
  <p>Here is the delete code:</p>
  
  <pre><code>&lt;?php
  
  if ($response = $sqs-&gt;delete_message('https://sqs.us-east-1.amazonaws.com/199992002821/SomeQueueSQS', $rcpt_hand)) {
    echo "Message deleted&lt;br&gt;";
  } else {
    echo "Message not deleted&lt;br&gt;";
  }
  
  // Get list of unprocessed and valid messages
  $rows = $sqs-&gt;get_queue_size('https://sqs.us-east-1.amazonaws.com/199992002821/SomeQueueSQS');
  
  echo "&lt;table&gt;";
  etc...
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Andre</p>