I'm trying the get PHP(and MySQL) to produce a page that
grabs ship date (unique) from one data table and then
adds a list of all the convicts that were on the ship.
something like this...


Anaconda
One voyage only
Male convicts on board
Sail date 12 Oct 1823

Convicts on board were:

Joe Bloggs
Peter Murphy
----------------------------

Anaconda2
Two voyages
Female convicts on board
Sail date 24 Jul 1819

Convicts on board were:

Mary Bloggs
Jane Murphy

... etc

The ships table has an unique ID field and an indexed field called "ship"
The convicts table has it's own unique ID field and also an indexed field
called "ship"

The code I've tried (don't worry about the includes) is this

<?php

Include ("common.inc");

if (!isset($currltr)) { // evaluates false
   $currltr = "A";
}

$db = mysql_connect("localhost", "root");

mysql_select_db("convicts",$db);

echo "<font face=\"arial\" color=\"#000000\" size=\"4\">Generator Page for
Tasmanian Convict Ship List - \"$currltr\" Ships</font><p>\n";

echo "<a href=\"convictadd.php\">Add a new ship</a><p>";

include ('salphamenu_dont_delete.inc');

echo "<hr>\n";

$result = mysql_query("SELECT * FROM ships ORDER BY ship",$db);

while ($row = mysql_fetch_array($result)) {

    If ($result) {
        $id = $row["id"];
        $ship = $row["ship"];
        $voyage = $row["voyage"];
        $sex = $row["sex"];
        $year = $row["year"];

        echo "<font size=\"3\"><b>$ship</b></font><br>
             <font size=\"2\">$voyage</font><br>
             <font size=\"2\">$sex</font><br>
             <font size=\"2\">$year</font><br>\n";

                While ($result) {
             $result2 = mysql_query("SELECT * FROM convicts WHERE
convicts.ship = $id ORDER BY convict",$db);
                         $row2 = mysql_fetch_array($result2)
             $id = $row2["id"];
                         $convict = $row2["convict"];
                         $ref = $row2["ref"];
                         $contact = $row2["contact"];

                         echo "<font size=\"3\">$convict</font><br>\n";

                }
    } Else {
               echo "<font color=\"#FF0000\"><b>Sorry no records for that
letter</b></font>\n";
    }
}

?>

Obviously it doesn't work ("of course" or "how stupid" to some one out
there) but we all gotta learn somewhere, sometime and I really am enjoying
learning PHP and MySQL.

Any way if any has any ideas? ...

Thanks in advance

Howard Picken
[EMAIL PROTECTED]
Launceston,  Tasmania, Australia


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to