title: When using json_encode to display the contents of a select query, how to name objects?
body: <p>Disregarding security issues (for now)</p>
  
  <p>I am using json_encode to display the contents of a select query. 
  I used:</p>
  
  <pre><code>$sql= {query code};
  
  // created a temp array to hold data and an array for all the results
  $resultArray = array();
  $tempArray = array();
  
  // looped through every object in the result set
  while ($row = $result-&gt;fetch_object());
  
  // added it into the results array
  $tempArray = $row;
  array_push($resultsArray, $temparray);
  
  // encoded the array to a json format
  echo json_encode($resultArray);
  </code></pre>
  
  <p>Question: My objects don't have names, so it makes it difficult for me to write any code that could read the results and display them. How do I name the objects? Is it an entry I could add into the table (let's say in a case of different names I could give each object)</p>