Scottmandoo Posted February 29, 2008 Share Posted February 29, 2008 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 Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 29, 2008 Share Posted February 29, 2008 http://www.tutorialized.com/view/tutorial/Pagination-with-PHP/6925 Quote Link to comment Share on other sites More sharing options...
Scottmandoo Posted February 29, 2008 Author Share Posted February 29, 2008 thanks that helped heaps Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.