This is my query:
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
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?
Also, if anyone sees a way I can optimize this query to make it even quicker, that would be great as well!
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:<br /><b>" . $querystring . "</b><br />"); // 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;
}
mysql_query.