title: PHP JSON parsing giving an error
body: <p>I am trying to parse a JSON string using PHP, the JSON gets sent to the PHP file using jQuery <code>$.ajax</code> in this format, <code>[{"value":"59"},{"value":"7"},{"value":"46"}]</code> , but for some odd reason I keep getting this error <code>"Invalid argument supplied for foreach()"</code>, here is my PHP and jQuery code,</p>
  
  <p>jQuery:</p>
  
  <pre><code>    $(".systems").each( function(i, system) {
          // for each location block
          system = $(system);
          var sys = {
              'value' : $("select[data-prod='products']", system).val()
          };
          allSystems.push( sys );
      });
  
          $.ajax({
                  type: 'POST',
                  url: 'systems.php',
                  dataType: 'json',
                  data: { systems: JSON.stringify(allSystems), uid: uid },
                  success: function(data){
                      alert(data)
                  }
          });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>require_once 'classes/Zend/Json.php';
  
  $json = $_POST['systems'];
  $uid = $_POST['uid'];
  $array= Zend_Json::decode("$json"); 
  
  mysql_connect('localhost','user','pass') or die(mysql_error());
  mysql_select_db('products') or die(mysql_error());
  
  //insert the suppliers products into the database
  foreach($array as $key){
      $query = mysql_query("INSERT INTO suppliersProducts (product_id, supplier_id) VALUES('".$key['value']."', '".$uid."' ) ") or die(mysql_error());
  }
  
  print_r($json);
  </code></pre>
  
  <p>As you can see I am using the Zend framework's JSON decode function to decode the JSON string that gets passed to the PHP, and the format seems correct to me so I have no idea what else it could be that is causing this error, maybe encoding? Any ideas?</p>
  
  <p>Thanx in advance!</p>