Hi all,
First post, and I'm obviously a newbie. I have a simple db with one table (of dvds, if you must know!). The code is not the most compact, but, hey, I'm just learning. The problem is that only one row of the table is displaying in the output.
Here's the php code I've gotten so far:
<?
$db_name = "criteriondb";
$table_name = "tblmain";
$connection = @mysql_connect("localhost", "USER", "PWD")
or die(mysql_error());
$db = @mysql_select_db($db_name, $connection) or die(mysql_error());
$sql = "SELECT * FROM $table_name ORDER BY spineNum DESC";
$result = @mysql_query($sql,$connection) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
$title = $row['title'];
$director = $row['director'];
$country = $row['country'];
$year = $row['year'];
$spineNum = $row['spineNum'];
$aspectRatio = $row['aspectRatio'];
$notes = $row['notes'];
$ownDVD = $row['ownDVD'];
$output = "<tr><td>$spineNum</td>";
if ($ownDVD == "1") {
$output .= "<td class=\"own\">$title</td>";
}
else {
$output .= "<td>$title</td>";
}
$output .= "<td>$director</td>
<td>$country</td>
<td>$year</td>
<td>$aspectRatio</td>
</tr>";
}
?>
I then have a simple table and am echoing the $output block in between the header and footer rows. The SELECT statement produces all the rows in mysql, just not through the php page. I've also altered my code a few times to be like examples I've seen here with no luck. I'm sure it's something simple...
Thanks in advance!