Hi,
I've created a sql data base and a web page to view the database evrything works fine but just wondering how to show only last 10 rows of the table in the webpage ??
The code I use now:
<?
$username='abc';
$password='abc'';
$database='kand_dedicates';
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM dedications";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<?php
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"name");
$f2=mysql_result($result,$i,"song");
$f3=mysql_result($result,$i,"ded_for");
?>
<table width="596" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14" height="60"> </td>
<td width="20" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"> </td>
<td width="146" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" style="BORDER-bottom: #333333 1px solid"><?php echo $f1; ?></span></td>
<td width="147" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" ><?php echo $f2; ?></span></td>
<td width="269" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" ><?php echo $f3; ?></span></td>
<?php
$i++;
}
?>
I've created a sql data base and a web page to view the database evrything works fine but just wondering how to show only last 10 rows of the table in the webpage ??
The code I use now:
<?
$username='abc';
$password='abc'';
$database='kand_dedicates';
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM dedications";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<?php
$i=0;
while ($i < $num) {
$f1=mysql_result($result,$i,"name");
$f2=mysql_result($result,$i,"song");
$f3=mysql_result($result,$i,"ded_for");
?>
<table width="596" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14" height="60"> </td>
<td width="20" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"> </td>
<td width="146" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" style="BORDER-bottom: #333333 1px solid"><?php echo $f1; ?></span></td>
<td width="147" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" ><?php echo $f2; ?></span></td>
<td width="269" bgcolor="#FFFFFF" class="style30" style="BORDER-bottom: #333333 1px solid"><span class="style30" ><?php echo $f3; ?></span></td>
<?php
$i++;
}
?>