Jump to content

How do you only display 8 rows per page? PHP/MYSQL


Scottmandoo

Recommended Posts

Hi, im new to PHP and MYSQL an am having a few problems.

 

In this code i need it to only display 8 rows per page and also it so that after more is added to the mysql database it automatically creates a new page to display the new rows on.

 

<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM tutorials WHERE tut_program='Photoshop' AND tut_category='Text Effects' ";
$result=mysql_query($query);

$num=mysql_numrows($result); 

mysql_close();

echo "<b><center>Database Output</center></b><br><br>";

?>
<link href="file:///C|/Users/Scott/SlyGraphics/style.css" rel="stylesheet" type="text/css" />

<title>SlyGraffix: Database Test</title><table width="287" border="0" align="center" cellpadding="2" cellspacing="0">
             
<?
$i=0;
while ($i < $num) {
$tut_name=mysql_result($result,$i,"tut_name");
$tut_link=mysql_result($result,$i,"tut_link");
$tut_program=mysql_result($result,$i,"tut_program");
$tut_category=mysql_result($result,$i,"tut_category");
$tut_video=mysql_result($result,$i,"tut_video");
$tut_download=mysql_result($result,$i,"tut_download");
$tut_image=mysql_result($result,$i,"tut_image");
?>

<tr>
                <td width="140"><a href="<? "$tut_link"; ?>"><img src="images/tutorials/fire_reflection.jpg" alt="d" width="140" height="120" border="0" /></a></td>
                <td width="139" valign="top"><p align="left"><a href="<? "$tut_link"; ?>"><? echo "$tut_name"; ?> </a> </p>
                    <p align="left"> Video: <? echo "$tut_video"; ?><br />
                      Download: <? echo "$tut_download"; ?><br />
                      External Link: Yes <br />
                      <br />
                      >
                      <? echo "$tut_program"; ?></p>
                    </td>
              </tr>
<?
++$i;
} 
echo "</table>";


?>

 

if you can help me i would appreciate it so much

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.