I have created a sql database and also a webpage to view the data's on a table everything works well.
But my problem is I just wanted to show only last 10 rows of the sql data not all the rows
Cheers!!!!
php at the moment i use is:
<?
$username='1111';
$password='11111';
$database='data_base';
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++;
}
?>
But my problem is I just wanted to show only last 10 rows of the sql data not all the rows
Cheers!!!!
php at the moment i use is:
<?
$username='1111';
$password='11111';
$database='data_base';
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++;
}
?>