Below is the query I'm working with...

PHP Code:
$res mysql_query ("SELECT SMP.N, SMP.URL, SMP.Name_First, SMP.Name_Middle, SMP.Name_Last,
SMGov.URL, SMGov.Term_Began, SMGov.Term_Ended, SMGov.Party G_P, SMGov.Notes, SMGov.Image,
SMM.URL, SMM.Term_Began TermB, SMM.Term_Ended TermE, SMM.Party M_P, SMM.Notes M_N,
SMW.URL, SMW.Class,
SMWA.URL, SMWA.Org, SMWA.Title, SMWA.Year_Began, SMWA.Year_Ended, SMWA.Year_Mid
FROM sm_ppl SMP
LEFT JOIN sm_ppl_gov SMGov ON SMGov.URL = SMP.URL
LEFT JOIN sm_ppl_mayor SMM ON SMM.URL = SMP.URL
LEFT JOIN sm_ppl_wrrs SMW ON SMW.URL = SMP.URL
LEFT JOIN sm_ppl_wrrs_assoc SMWA ON SMWA.URL = SMP.URL
WHERE SMP.URL = '
$MyURL'") or die (mysql_error());

while (
$row mysql_fetch_array ($res))
{
$TermB $row['TermB'];
$TermE $row['TermE'];

echo 
$TermB;

echo 
$TermE;

The query includes the following aliases...

Code:
SMM.Term_Began TermB, SMM.Term_Ended TermE
...which are echoed at the bottom of the script.

It works for one-term mayors, but it doesn't display the second row for people who had split terms, as follows:

Code:
URL | Term_Began | Term_Ended
Hiram_Gill | 1910 | 1911
Jay_Scott | 1911 | 1914
Hiram_Gill | 1914 | 1916
For Hiram Gill, it displays just 1910 and 1911 (not 1914 and 1916), even though I inserted the echo statement inside the while loop. Any tips?

Thanks.