title: PHP: JSON decoding
body: <p>I keep getting stuck trying to decode some json I'm getting back from a db query:</p>
  
  <p>My result = </p>
  
  <pre><code>{"queryResults":[{"id":"1","pageName":"home","blurb":"&lt;p&gt;knowInk Publishing is a Media Professional Services firm dedicated to integrating existing publications into the technology of today, introduce the publications of the future and provide traditional services for the print industry.&lt;\/p&gt; \r\n&lt;p&gt;From e-publishing, e-singles, mobile, web and print design and development, printing on demand and our editorial services we can provide a nuts to soup solution to your publishing needs.&lt;\/p&gt;\r\nLearn more about how KI can help you.","imgPath":"images\/img_homepage.jpg"},{"id":"3","pageName":"about","blurb":"This is where the about text would go. ","imgPath":"images\/img_about.jpg"},{"id":"4","pageName":"services","blurb":"This is where we would talk about the services we can provide","imgPath":"images\/img_services.jpg"},{"id":"5","pageName":"marketplace","blurb":"This is where we will discuss our marketplace, where you can buy and sell things","imgPath":"images\/img_marketplace.jpg"}]}
  </code></pre>
  
  <p>I put the json into a session var and am able to retrieve it. But when I go to dig into it I am getting stuck. Here's my PHP code:</p>
  
  <pre><code>print $_SESSION['basicPageHTML']; //works fine, gives me the json above
  
  $code = json_decode($_SESSION['basicPageHTML']); 
  print count($code-&gt;queryResults); //this seems right, gives me 4
  foreach($code-&gt;queryResults as $thisKey =&gt; $thisValue) { 
       //I can't do anything here.
  }
  </code></pre>
  
  <p>I've been away from PHP for a bit and it's funny how you forget so quickly...</p>