Petite-Dragon Posted March 6, 2015 Share Posted March 6, 2015 i have found some tutorials in the internet but it did not suit for my code <table width="400" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form id="form1" name="form1" method="post" action="add_new_topic.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3" bgcolor="#E6E6E6"><strong>Create New Topic</strong> </td> </tr> <tr> <td width="14%"><strong>Topic</strong></td> <td width="2%">:</td> <td width="84%"><input name="topic" type="text" id="topic" size="50" /></td> </tr> <tr> <td valign="top"><strong>Detail</strong></td> <td valign="top">:</td> <td><textarea name="detail" cols="50" rows="3" id="detail"></textarea></td> </tr> <tr> <td><strong>Name</strong></td> <td>:</td> <td><input name="name" type="text" id="name" size="50" /></td> </tr> <tr> <td><strong>Email</strong></td> <td>:</td> <td><input name="email" type="text" id="email" size="50" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Submit" /> <input type="reset" name="Submit2" value="Reset" /></td> </tr> </table> </td> </form> </tr> </table> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="myforum"; // Database name $tbl_name="fquestions"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name ORDER BY id DESC"; // OREDER BY id DESC is order result by descending $result=mysql_query($sql); ?> <br> <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td width="6%" align="center" bgcolor="#E6E6E6"><strong>Topic ID</strong></td> <td width="20%" align="center" bgcolor="#E6E6E6"><strong>Topic Name</strong></td> <td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td> <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Replies</strong></td> <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td> <td width="13%" align="center" bgcolor="#E6E6E6"><strong>Delete</strong></td> </tr> <?php // Start looping table row while($rows = mysql_fetch_array($result)){ ?> <tr> <td align="center"><?php echo $rows['id']; ?></td> <td align="center" bgcolor="#FFFFFF"><a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['topic']; ?></a></td> <td align="center" bgcolor="#FFFFFF"><?php echo $rows['view']; ?></td> <td align="center" bgcolor="#FFFFFF"><?php echo $rows['reply']; ?></td> <td align="center" bgcolor="#FFFFFF"><?php echo $rows['datetime']; ?></td> <td align="center" bgcolor="#FFFFFF"><a href="deletefile.php?id=<?php echo $rows['id']; ?>" onClick="return myFunction()">Delete</a></center></td> </tr> <?php // Exit looping and close connection } mysql_close(); ?> </table> <script> function myFunction() { var x = confirm("Are you sure you want to delete this topic? ?"); if (x==true) { window.location ="deletefile.php"; } else { window.location="main_forum.php"; } return x; } </script> This is the output of the code above i just need help to make a page pagination for this i will accept any design,limit of pagination,styles,techniques i really have no idea how to paginate things thank you in advance Link to comment https://forums.phpfreaks.com/topic/295144-page-pagination-phpmysql/ Share on other sites More sharing options...
PravinS Posted March 6, 2015 Share Posted March 6, 2015 Check this script online http://www.php-guru.in/2014/pagination-php-mysql/ Link to comment https://forums.phpfreaks.com/topic/295144-page-pagination-phpmysql/#findComment-1507770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.