I am trying to display two names horizontally from the database. After two names have been displayed I want to drop down, start the table again and display the next two names from the database so the output looks like this:
justin mick
paul darren
ian dean
and so on.....
It is displaying horizontally, however It is not stopping at two names. Your help would be greatly apreciated.
Thank you.
Here is my code below
<?PHP //display names horizontally ?>
<td width="747" valign="baseline" height="189" align="center"><div align="center"></div>
<?PHP
if(!isset($start)) $start = 0;
include("db.php");
mysql_connect($servername,$username,$password);
$query = "SELECT * FROM names ORDER BY id DESC LIMIT " . $start . ", 50";
@mysql_select_db($database) or die( "Cannot select the database");
$result = mysql_query($query);
$num=mysql_numrows($result);
?>
<?
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"name");
?>
<table width="1%" border="0" align="center" cellpadding="3" cellspacing="3">
<tr>
<td width="4%" height="43"> <font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><? echo $name; ></font></td>
<td width="96%">
<?
++$i;
}
?>
</td>
</tr>
</table><br>