darkfreaks Posted February 18, 2008 Share Posted February 18, 2008 okay i tried changing the code and i just get a link with << in it and an empty table with no data ??? is there anyway i could fix this ??? <?php define('IN_PHPBB', true); $phpbb_root_path = '../architect-jobs-forum/'; include ($phpbb_root_path . 'extension.inc'); include ($phpbb_root_path . 'common.' . $phpEx); $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); require "../db_conn.inc.php"; $page_title = 'Architect Job Postings'; include ('../includes/header.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td align="left" valign="top"> <h1><img src="/images/sq_3.gif" width="17" height="17" hspace="5" vspace="5" align="left">Job Postings</h1> </td> <td align="right" valign="bottom"><a href="http://www.arkitectum.com/architect-jobs/jobs.php?action=job"><img src="/images/but_post_job.gif" alt="Post an architect job" width="108" height="24" hspace="4" vspace="4" border="0"></a></td> </tr> </table> <table width="100%" border="0" cellspacing="1" cellpadding="2"> <tr> <td align="left"> <p><b>Job Seekers:</b> Subscribe to our mailing list and receive daily emails with the latest job postings.</p> <form action="http://www.arkitectum.com/architect-jobs-forum/profile.php?mode=register" method="post"> <p><input type="text" id="email" name="email" value="email address" onFocus="this.value=''"><input name="Submit" type="submit" value="Subscribe"></p> </form> </td> <td align="right" valign="bottom"> </td> </tr> </table> <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" class="forumline"> <tr> <th class="thTop" align="center">Job Title</th> <th align="center">Location</th> <th align="center">Posted</th> </tr><?php $page =(isset($_GET['page']))?$_GET['page']:1; $max_results = 25; $from = (($page * $max_results) - $max_results); function clean($string){ $new = trim(strip_tags(mysql_real_escape_string(htmlentities($string)))); return $new; } if (isset($_POST['Search'])) { $total_results = "SELECT * FROM jobs WHERE NOW() < expires AND paid = '1' "; if ($_POST['keyword'] != '') { $find = strtoupper(clean($_POST['keyword'])); $location = clean($_POST['location']); $category = clean($_POST['category']); if (($_POST['category'] != '') && ($_POST['location'] != '')) { $total_results .= "AND category = '" .$category."' OR location = '" .$location . "'OR title LIKE '%$find%'";; } elseif (($_POST['category'] != '') && ($_POST['location'] == '')) { $total_results .= "AND category = '" . $category . "' OR title LIKE '%$find%' ";; } elseif (($_POST['category'] == '') && ($_POST['location'] != '')) { $total_results .= " AND location = '" . $location ."' OR title LIKE '%$find%'";; } else { $total_results .= "AND title LIKE '%$find%'"; } $search = true; } else { if ($_POST['location'] != '') { if ($_POST['category'] == '') { $total_results .= "AND location = '" . $location ."' "; $search = true; } } if ($_POST['category'] != '') { if ($_POST['location'] == '') { $total_results .= "AND category = '" . $category."' "; $search = true; } } if ($_POST['category'] != '' && $_POST['location'] != '') { $total_results .= "AND category = '" . $category ."' AND location = '" . $location ."' "; $search = true; } } if ($search) { $totalrows = mysql_query($total_results) or die(mysql_error()); $num = mysql_num_rows($totalrows); $total_pages = ceil($num / $max_results); $total_results .="ORDER BY job_id DESC LIMIT $from,$max_results"; $aa = mysql_query($total_results) or die(mysql_error()); while ($row = mysql_fetch_array($aa)) { echo " <tr> <td align='left' valign='top' bgcolor='#F2F5F9'> <b><a href='view-job.php?job_id={$row['job_id']}'>" .stripslashes($row['title']) . "</a></b> <br>" . stripslashes($row['employer']) ." </td> <td align='left' valign='top' bgcolor='#F2F5F9'> {$row['city']}, {$row['location']} </td> <td align='center' valign='top' bgcolor='#F2F5F9' width='70' class='small_10'>" . date('M d, y', strtotime($row['date'])) . " </td> </tr>"; } // End While } echo "</table>"; echo "<p align='right'>"; if ($page <= 1) { echo " <a href='#'><<</a> "; } else { $prev = ($page - 1); echo " <a href=\"" . $_SERVER['PHP_SELF'] . "?page=$prev\"><<</a> "; } for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { echo "[$i] "; } else { echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=$i\">$i</a> "; } } if ($page < $total_pages) { $next = ($page + 1); echo " <a href=\"" . $_SERVER['PHP_SELF'] . "?page=$next\"> >></a> "; } echo '</p>'; } // End if form was submitted include_once ('../includes/footer.htm'); ?> </table> </body> </html> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 18, 2008 Author Share Posted February 18, 2008 anyone ??? Quote Link to comment Share on other sites More sharing options...
sasa Posted February 18, 2008 Share Posted February 18, 2008 try to echo $num Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 18, 2008 Author Share Posted February 18, 2008 its not $num its equals ten and when i change $i<=$total_pages to $i<=10 it paginates 10 pages correctly but not with the new code. 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.