A few things I've noticed....
1. Each time the while() loop iterates, $array is reassigned to the next row in your MySQL result set, so that $array is always just the last row.
2. The length of that array will be the number of columns in the row, which would be id+name+opened+manufacturer+image=5, which is NOT the total number of rows in the result set (up to 50).
3. This length isn't useful anyway, because what you want is the number of rows in the result set, not the number of columns.
Instead of trying to make this code work, I've rewritten it below.
<?php
//CONNECT TO THE DATABASE
$link=mysql_connect('HOSTNAME','USERNAME','PASSWOR
D')
or die('Could not connect: ' . mysql_error());
mysql_select_db('DATABASENAME') or die('Could not select database');
//GET ALL OF THE ENTRIES FROM THE DATABASE
$result = mysql_query("SELECT `id` , `name` , `opened` , `manufacturer` , `image` FROM `rollercoasters` ORDER BY `name` DESC LIMIT 0 , 50");
if (!$result) {
echo mysql_error();
exit;
}
//DISCONNECT FROM THE DATABASE
mysql_close($link);
include "skin_header.php";
?>
<tr>
<td width="100%" height="100%" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="5" height="189">
<tr>
<td width="100%" valign="top" height="176">
<p align="center"><b><font face="Arial" size="3">Roller
Coasters</font></b></p>
<table border="0" width="100%" cellspacing="0" cellpadding="5">
<?php
$i=0;
while ($array = mysql_fetch_array($result)) {
extract($array);
if($i==3) {
echo '</tr><tr>';
$i=0;
} else {
$i++;
} // end if
echo "<td width='33%'><img border='0' src='attractions/rollercoasters/$image.gif' width='102' height='77'><br><font face='Arial' size='2'><u><a href='viewcoaster.php?id=$id'><font color='#000000'>$name</font></a></u><br></font><font face='Arial' size='1'>$opened - $manufacturer</font></td>";
} //end while
?>
</table>
</td>
<?php
include "skin_footer.php";
?>
Note the use of extract. It is a quick way to create variables from the key names of an array, i.e., it does the same thing as
$id = $array['id'];
$name = $array['name'];
$opened = $array['opened'];
$manufacturer = $array['manufacturer'];
$image = $array['image'];
EDITS: Some grammar edits at the beginning of this post. I have to learn to stop trying to write coherently late at night!