numbering sql returns
Posted: Fri Jul 30, 2004 3:01 pm
this returns all my records in my data base and just gives the names but I want to number the returns using the $num that is in the display block
Code: Select all
<?php
$db = @mysql_select_db($db_name, $connection)
or die("Couldn't select database.");
$sql = "SELECT fname, lname
FROM $table_name
ORDER BY lname
";
$result = @mysql_query($sql,$connection)
or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$fname = $row['fname'];
$lname = $row['lname'];
$display_block .= "
<P><h2>($num)</h2>
<strong>$lname, $fname</strong><hr>
";
}
?>
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<BODY>
<? echo "$display_block"; ?>
</BODY>
</HTML>
?>