Thanks for that.  I've cleaned up things a bit for the time being.

I'm still getting an error though.

Parse error: parse error in c:\usr\local\www\pages/ships.php on line 30

Line 30 turns out to be  $convict = $row["convict"];  so I'm assuming that
it's having trouble with the array. I've tried changing $row to $row2 to no
avail.
That also why I had the rest of the convicts fields in the first place (but
didn't
display then).

When I originally played with this I used a Left Join between the two tables
and it all
worked accept only one convict was returned for each ship and ship's were
listed more than once
if there were more than one convict on the ship (of course).

Anyway here is the cleaned up code.

<?php

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

mysql_select_db("convicts",$db);

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

If ($result) {

    while ($row = mysql_fetch_array($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><p>\n";

             $result2 = mysql_query("SELECT * FROM convicts WHERE ship =
'$id' ORDER BY convict",$db);
                         $row = mysql_fetch_array($result2)
                         $convict = $row["convict"];

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

    }

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

?>


-- 
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