$sql = “SELECT a.*, b.* from table1 a, table2 b WHERE a.id=b.id”; // example sql
$r = mysql_query($sql,$conn); if (!$r) die(mysql_error()); $numfields = mysql_num_fields($r); $tfields = Array(); for ($i=0;$i<$numfields;$i++) { $field = mysql_fetch_field($r,$i); $tfields[$i] = $field->table.’.’.$field->name; } while ($row = mysql_fetch_row($r)) { $rowAssoc = Array(); for ($i=0;$i<$numfields;$i++) { $rowAssoc[$tfields[$i]] = $row[$i]; } // do stuff with $rowAssoc as if it was $rowAssoc = mysql_fetch_assoc($r) you had used, but with table. prefixes } |