Best way to filter mySQL data *after* querying?
Posted: Wed Apr 06, 2011 5:58 pm
I have a mySQL query that grabs a bunch of data, but when I display it in tables, I want to have one group of data displayed in one table and another group of data displayed in another table (based on a column, say "filtering_category"). Currently, I accomplish this this way:
This seemed to work until I realized today that it cuts off the first result of the second table. I could just ask to fix the code, but I really want to know if there's a better way of accomplishing this (filtering data from a single query to display them differently).
Thanks in advance!
Code: Select all
while($results = mysql_fetch_array($result_set) and $results['filtering_category'] == 1){
// print table 1
}
while($results = mysql_fetch_array($result_set)){
// print table 2
}
Thanks in advance!