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
That also why I had the rest of the convicts fields in the first place (but
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.


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


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

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


PHP Database Mailing List (
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