Creating an array that holds the 11 combined records from the two tables,
and sorting the array according to date:  (This depends on what type your
using to store dates in MySQL, and that the exact date is unique for each
record across both tables.  If the date isn't unique, it requires a little
modification to the assignment in the array and the display later on.)

<?
$res = mysql_query("select * from table1");
while ($tmp = mysql_fetch_object($res))
  $tbl_arr[$tmp->date_field_name] = $tmp;
mysql_free_result($res);
// repeat previous 4 lines for table2.

sort($tbl_arr);

foreach($tbl_arr as $dt => $record)
  echo date(" -- date format -- ", $dt) . "<br>$record->field1 -
$record->field2 - etc...";
?>

  -- Rob

"Mark McCulligh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I can't link the two tables at all.
>
> I need to loop through one displaying its information, then loop through
the
> other table displaying its information.  For if I have 5 records in table
A
> and 6 records in table B, I get 11 records total. Each table only has 4-5
> fields and they exist in both table. The two tables have the same
structure
> minus one field.  The two tables should have been one table but I didn't
> design the database but have to make it work. Using I would use a view to
> make one master table then order it by the common date field. But MySQL
> doesn't have view let.
>
> The reason I can't just display one table after the other is that I need
the
> PHP page to have the results ordered by the common date field.
>
> I can't link the two tables together in the SQL.
>
> Mark.
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to