title: Why is my MySQL query returning a multidimensional array rather than a single-dimension array?
body: <p>This is my query: </p>
  
  <pre><code>SELECT DISTINCT ap.apptype_id
  FROM tblSubmission AS s
  JOIN tblApp AS ap ON ap.app_id = s.app_id
  WHERE s.app_id =406
  OR s.app_id =180
  OR s.app_id =179
  </code></pre>
  
  <p>It returns just unique apptype_ids pertaining to rows in a database. It works right now like it should, except for the fact that it returns a multidimensional array, rather than a single-dimension array. I could go ahead and write a PHP function that resolves this, but I would rather have the query return the array properly rather than make the server do extra work to fix the problem with the query. Can anyone help me out?</p>
  
  <p>Also, if anyone sees a way I can optimize this query to make it even quicker, that would be great as well! </p>
  
  <pre><code>function db_query($querystring) { 
     $rec_set = array(); 
     $result = mysql_query($querystring); 
     if (!$result) { 
         // do nothing, query might have failed but it might have just returned no results          
         #echo ("Invalid Query Result:&lt;br /&gt;&lt;b&gt;" . $querystring . "&lt;/b&gt;&lt;br /&gt;"); // debug 
      }elseif($result === true){ 
         // do nothing, query didn't return anything but succeeded 
      }else{ 
         while ($row = mysql_fetch_assoc($result)) { $rec_set[] = $row; }            
         mysql_free_result($result); 
      } 
      return $rec_set; 
    }
  </code></pre>