i would like to know the best way to combine result sets from a php query to mysql.... Ex:
$sql1 = "SELECT index, name FROM table WHERE field_A = 'ABC' ORDER BY field_F"; $result1 = the results from a correctly executed query of $sql1. $sql2 = "SELECT index, name FROM table WHERE field_A = 'DEF' ORDER BY field_W"; $result2 = the results from a correctly executed query of $sql2. $sql3 = "SELECT index, name FROM table WHERE field_A = 'GHI' ORDER BY field_Y"; $result3 = the results from a correctly executed query of $sql3. and then combine $result1 with $result2 appeneded to the end, and the same for $result3. almost like appending an array to another one. like a complete list of rows rather then 3 sets. the key is that the selected fields would be the same, but the criteria in the where / order by may differ. so running: $result = combined sets of $result1, 2 and 3 while ( $row=mysql_fetch_array($result)) { $name = $row['name']; echo "$name"; } would be the same as : running the loop on seperate result sets. while ( $row=mysql_fetch_array($result1)) { $name = $row['name']; echo "$name"; } while ( $row=mysql_fetch_array($result2)) { $name = $row['name']; echo "$name"; } while ( $row=mysql_fetch_array($result3)) { $name = $row['name']; echo "$name"; } probably aint possible or more resource overhead then just runnin indie queries in a result array. ? thanks all Joel Colombo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php