Where can I learn topics such as: 1) Examples of complex PHP applications entering data into complex related table structures. For instance, if I am writing an application to create a class catalog that has 5 related tables, how do I handle the workflow when the data in related tables doesn't yet exist? Do I force a user to enter data into 5 different forms first? Do I have a place to enter the new data on the main form? Do I create temporary records as part of a step-by-step process? 2) Complex display with database results-- particularly when working with many joined tables, displaying results effectively for reporting (show me all departments, within that all classes, within that who is teaching, sorted by department). The queries aren't hard, but if optimized into one big query the constructs for displaying seem to get ugly. For instance, given a query that gives me these results as $result (joined together from three tables): +---------+----------+----------+-----------+-------+ | first | last | relation | city | state | +---------+----------+----------+-----------+-------+ | Chris | Beks | business | Fairbanks | AK | | Robert | Hannon | friend | Fairbanks | AK | | Cindy | Lott | family | Fresno | CA | | Derryl | Hartz | business | Seattle | WA | | Kirsten | O'Malley | friend | Seattle | WA | +---------+----------+----------+-----------+-------+ It seems like there must be a more efficient way to get a listing of each city and who lives there than: $currentcity = ''; $counter = 1; while ($thisrow = mysql_fetch_array($result)) { if ($currentcity <> $thisrow['city']) { if ($counter > 1) { echo '</blockquote>'; } echo '<h1>' . $thisrow['city'] . '</h1>'; echo '<blockquote>'; $currentcity = $thisrow['city']; } echo $thisrow['first'] . ' ' . $thisrow['last'] . '<br />'; $counter++; } Although this is preferable to running separate queries: $query = 'select lid, city, state from locations order by city, state'; $result = mysql_query($query) or die('Couldn\'t perform the query: ' . $query); while ($thisrow = mysql_fetch_array($result)) { echo '<h1>' . $thisrow['city'] . ', ' . $thisrow['state'] . '</h1>'; echo '<blockquote>'; $pquery = "select first, last from people where lid = {$thisrow['lid']} order by last, first"; $presult = mysql_query($pquery) or die('Couldn\'t perform the query: ' . $query); while ($prow = mysql_fetch_array($presult)) { echo $prow['first'] . ' ' . $prow['last'] . '<br />'; } echo '</blockquote>'; } c -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php