title: How to represent One-to-Many relationship in JSON using Php?
body: <p>I have a MySQL table that has two columns 
  customer_id and item_id, </p>
  
  <p>customer_id can have multiple item_id, (One to many relationships), </p>
  
  <p>How can I represent/loop through the returned query generate a JSON output (similar to the structure above) ,using MySQL and PHP? </p>
  
  <p>for example, I want my JSON output to look like this:</p>
  
  <pre><code>  {
          "data": 
           {
              "customer_id": "10",
              "item_id": " 1"
            },
           {
             "customer_id": "10",
              "item_id": " 2"
           },
    {
             "customer_id": "10",
             "item_id": " 3"
           }
     }
  </code></pre>
  
  <p>thanks. </p>