fypstudent Posted September 17, 2008 Share Posted September 17, 2008 Hi i created a web portal that allows the admin to view the staff's timetable. I display all the information by pagination and i faced this problem. http://www.flickr.com/photos/75437207@N00/2865205432/ as you can see in the picture, when i click on the Next and Last, it doesn't direct me to the page 2 or last page. <?php session_start(); echo $staffid; ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Staff Signage: Web Portal</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"><?php include("./include/headerAdmin.php"); ?></td> </tr> <tr> <td colspan="4" bgcolor="#FFFFFF" height="6"></td> </tr> <tr> <td width="5" valign="top" bgcolor="#FFFFFF"> </td> <td width="175" align="center" valign="top" bgcolor="#FFFFFF"><?php include("./include/leftBar.php");?></td> <td width="7" bgcolor="#FFFFFF"> </td> <td width="614" valign="top" bgcolor="#FFFFFF"><table width="605" align="center" cellspacing="0"> <tr> <td height="20" valign="middle" bgcolor="#437AB6" class="contentHeader"> View current timetable</td> </tr> <tr> </tr> <tr> <td height="20" valign="top" bgcolor="#FAFAF5"> <?php // Connects to your Database mysql_connect("localhost", "root", "root") or die(mysql_error()); mysql_select_db("staffsignage") or die(mysql_error()); //This checks to see if there is a page number. If not, it will set it to page 1 if (!(isset($pagenum))) { $pagenum = 1; } //Here we count the number of results //Edit $data to be your query $data = mysql_query("SELECT * FROM timetable") or die(mysql_error()); $rows = mysql_num_rows($data); //This is the number of results displayed per page $page_rows = 20; //This tells us the page number of our last page $last = ceil($rows/$page_rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //This sets the range to display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; //This is your query again, the same one... the only difference is we add $max into it $data_p = mysql_query("SELECT staffid, day, sem, weeks, day, start, end, lecturer FROM timetable $max") or die(mysql_error()); //This is where you display your query results echo "<table cellpadding='0' class='contentText'>"; while (list($staffid, $day, $start, $end, $mod, $sem, $weeks, $lecturer) = mysql_fetch_row($data_p)) { echo "<tr>"; echo "<td>".$staffid."</td>"; echo "<td width = 3%>"; echo "<td>".$day."</td>"; echo "<td width = 3%>"; echo "<td>".$start."</td>"; echo "<td width = 3%>"; echo "<td>".$end."</td>"; echo "<td width = 3%>"; echo "<td>".$mod."</td>"; echo "<td width = 3%>"; echo "<td>".$sem."</td>"; echo "<td width = 3%>"; echo "<td>".$weeks."</td>"; echo "<td width = 3%>"; echo "<td>".$lecturer."</td>"; echo "</tr>"; } echo "</table>"; // This shows the user what page they are on, and the total number of pages echo "<p>"; echo "<center><span class='contentText'> Page $pagenum of $last<p></center></span>"; // First we check if we are on page one. If we are then we don't need a link to the previous page or the first page so we do nothing. If we aren't then we generate links to the first page, and to the previous page. if ($pagenum == 1) { } else { echo " <span class='contentText'><a href='{$_SERVER['PHP_SELF']}?pagenum=1'>First</a> | </span> "; echo " "; $previous = $pagenum-1; echo "<span class='contentText'><a href='{$_SERVER['PHP_SELF']}?pagenum=$previous'>< Previous</a> |</span> "; } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo "<span class='contentText'><a href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next ></a> | </span>"; echo "<span class='contentText'><a href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last</a></span> "; } ?> </td> </tr> </table> <p><br /> </p></td> </tr> <tr> <td colspan="4"><?php include("include/footer.php") ?></td> </tr> </table> </body> </html> <?php ob_flush(); ?> Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/ Share on other sites More sharing options...
ranjuvs Posted September 17, 2008 Share Posted September 17, 2008 Please paste here the HTML source code Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-643634 Share on other sites More sharing options...
fypstudent Posted September 17, 2008 Author Share Posted September 17, 2008 Please paste here the HTML source code hrm sorry, what html code are you referring? the one that i pasted in there is the php code...there's no html... Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-643655 Share on other sites More sharing options...
ranjuvs Posted September 17, 2008 Share Posted September 17, 2008 You could get it by Ctrl + u (Firefox) View -> Source (ie) Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-643658 Share on other sites More sharing options...
fypstudent Posted September 17, 2008 Author Share Posted September 17, 2008 You could get it by Ctrl + u (Firefox) View -> Source (ie) This is the code displayed from safari <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Staff Signage: Web Portal</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <table width="800" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="4"> <link href="style.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { background-color: #CCCCCC; } a:link { color: #FFFFFF; text-decoration: none; } a:visited { text-decoration: none; color: #FFFFFF; } a:hover { text-decoration: underline; color: #FFFFFF; } a:active { text-decoration: none; } --> </style> <table id="Table_01" width="800" height="136" border="0" cellpadding="0" cellspacing="0"> <tr> <td rowspan="2"> <img src="images/headerAdmin_01.jpg" width="337" height="136" alt=""></td> <td background="images/headerAdmin_02.jpg" width="463" height="25"><table width="457" border="0"> <tr> <td width="13"></td> <td width="434"><div align="right"> <span class='header'>Logged in as admin | </span> <a href = 'logout2.php'> <span class = 'header'>Logout</span></a> </span></div></td> </tr> </table></td> </tr> <tr> <td><img src="images/headerAdmin_03.jpg" width="463" height="111" alt="" /></td> </tr> </table> </td> </tr> <tr> <td colspan="4" bgcolor="#FFFFFF" height="6"></td> </tr> <tr> <td width="5" valign="top" bgcolor="#FFFFFF"> </td> <td width="175" align="center" valign="top" bgcolor="#FFFFFF"> <link href="style.css" rel="stylesheet" type="text/css"/> <table width="170" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="20" valign="middle" bgcolor="#437AB6" class="contentHeader"> Welcome!</td> </tr> <tr> <td bgcolor="#FAFAF5"><p align="left" class="contentText">Welcome Admin, to your control panel. Check out these links to get you started!</p> <p align="left" class="style10"><span class="contentText"><a href="admin_main3.php">Home</a><br /> <a href="admin_create2.php">Add Staff</a><br /> <a href="admin_view2.php">Delete Staff</a><br /> <a href="import2.php">Import Staff Timetable</a><br /> <a href="admin_timetable.php">VIew current timetable</a><br /> <a href="admin_search2.php">Staff Search</a></span></p> </td> </tr> <tr> </tr> </table> <p> </p> <p> </p> </td> <td width="7" bgcolor="#FFFFFF"> </td> <td width="614" valign="top" bgcolor="#FFFFFF"><table width="605" align="center" cellspacing="0"> <tr> <td height="20" valign="middle" bgcolor="#437AB6" class="contentHeader"> View current timetable</td> </tr> <tr> </tr> <tr> <td height="20" valign="top" bgcolor="#FAFAF5"> <table cellpadding='0' class='contentText'><tr><td> A0099</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>10:00</td><td width = 3%><td>11:00</td><td width = 3%><td>Ong-Tan Shih Wui Shirley</td></tr><tr><td> P0234</td><td width = 3%><td>Thu</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Thu</td><td width = 3%><td>13:00</td><td width = 3%><td>15:00</td><td width = 3%><td>Fang-Fua Ying Huey</td></tr><tr><td>A00632</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>12:00</td><td width = 3%><td>14:00</td><td width = 3%><td>Soon Hui Shin Vivien</td></tr><tr><td>A00632</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>16:00</td><td width = 3%><td>17:00</td><td width = 3%><td>Soon Hui Shin Vivien</td></tr><tr><td>A00632</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>8:00</td><td width = 3%><td>10:00</td><td width = 3%><td>Soon Hui Shin Vivien</td></tr><tr><td>A00632</td><td width = 3%><td>Thu</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Thu</td><td width = 3%><td>12:00</td><td width = 3%><td>14:00</td><td width = 3%><td>Soon Hui Shin Vivien</td></tr><tr><td>A00632</td><td width = 3%><td>Thu</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Thu</td><td width = 3%><td>9:00</td><td width = 3%><td>10:00</td><td width = 3%><td>Soon Hui Shin Vivien</td></tr><tr><td>A00782</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>15:00</td><td width = 3%><td>16:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>16:00</td><td width = 3%><td>18:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Thu</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Thu</td><td width = 3%><td>11:00</td><td width = 3%><td>12:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Tue</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Tue</td><td width = 3%><td>12:00</td><td width = 3%><td>14:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Tue</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Tue</td><td width = 3%><td>14:00</td><td width = 3%><td>16:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Tue</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Tue</td><td width = 3%><td>16:00</td><td width = 3%><td>18:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00782</td><td width = 3%><td>Wed</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Wed</td><td width = 3%><td>9:00</td><td width = 3%><td>11:00</td><td width = 3%><td>Lim Lee Ling Linda</td></tr><tr><td>A00852</td><td width = 3%><td>Mon</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Mon</td><td width = 3%><td>16:00</td><td width = 3%><td>17:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr><tr><td>A00852</td><td width = 3%><td>Thu</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Thu</td><td width = 3%><td>16:00</td><td width = 3%><td>18:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr><tr><td>A00852</td><td width = 3%><td>Tue</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Tue</td><td width = 3%><td>9:00</td><td width = 3%><td>11:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr><tr><td>A00852</td><td width = 3%><td>Wed</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Wed</td><td width = 3%><td>13:00</td><td width = 3%><td>14:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr><tr><td>A00852</td><td width = 3%><td>Wed</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Wed</td><td width = 3%><td>14:00</td><td width = 3%><td>16:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr><tr><td>A00852</td><td width = 3%><td>Wed</td><td width = 3%><td>Apr</td><td width = 3%><td>1-6,10-17</td><td width = 3%><td>Wed</td><td width = 3%><td>8:00</td><td width = 3%><td>10:00</td><td width = 3%><td>Goh-Lim Eng Lian Jenny</td></tr></table><p><center><span class='contentText'> Page 1 of 47<p></center></span><span class='contentText'><a href='/web portal (staff)v1 2/admin_timetable.php?pagenum=2'>Next ></a> | </span><span class='contentText'><a href='/web portal (staff)v1 2/admin_timetable.php?pagenum=47'>Last</a></span> </td> </tr> </table> <p><br /> </p></td> </tr> <tr> <td colspan="4"> <table id="Table_01" width="800" height="26" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <img src="images/footer.jpg" width="800" height="26" alt=""></td> </tr> </table> </td> </tr> </table> </body> </html> Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-643663 Share on other sites More sharing options...
fypstudent Posted September 17, 2008 Author Share Posted September 17, 2008 anyone can help me? ??? Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-643839 Share on other sites More sharing options...
fypstudent Posted September 18, 2008 Author Share Posted September 18, 2008 anyone can help me? ??? anybody help...? Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-644353 Share on other sites More sharing options...
fypstudent Posted September 18, 2008 Author Share Posted September 18, 2008 solved! Link to comment https://forums.phpfreaks.com/topic/124618-pagination-nextlast-link-page-doesnt-direct-to-next-page/#findComment-644488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.