title: SQL Results as PHP Array
body: <p>How do I get a SQL result that will contain multiple rows into an array:</p>
  
  <p>Example SQL Table:</p>
  
  <pre><code>ID      Cat        LineID      Qty    DealID    Cost
  1       Phone      1           2      8941      25.00
  2       Phone      2           43     8941      85.00
  3       Net        1           2      8941       1.00
  4       App        1           1      8941      87.00
  5       Phone      1           20     8942      98.00
  </code></pre>
  
  <p>Would like to be able to return the result like:</p>
  
  <pre><code>$product[Phone][LineID][Qty]
  $product[Phone][1][Qty] -- this would return 2
  </code></pre>
  
  <p>BTW: Within a Cat the LineID would never be duplicated, but it may not alway be the same LineID's - for Example under DealID 8941 there might be LineID for Cat>Phones 1,2,3,4 but under a different DealID there might only be Cat>Phones 4,5</p>
  
  <p>Not sure if I'm barking up the complete wrong tree, basicly I need to loop through all the results under a DealID then cross reference the LineID to get all the information about that LineID from a another table which holds the name, image etc...Then put into a html table along the lines of:</p>
  
  <pre><code>Product Name     Qty     Cost     Line Total
  Phone 1           1      85.00    85.00
  </code></pre>
  
  <p>I hope I have made this clear, if not don't be too harsh!!</p>
  
  <p>Thanks,
  B.</p>