Jump to content

solvision

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

solvision's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks guys, i figured it would be through passing the required where value. This has been really helpful. Now if i could only figure out my paging problem i'd be done
  2. Hey Guys After shrinking my website down considerably, i still have one more section i think can be shrunk further. I have 5 pages, all call the same database and display it the same way. The only thing that changes is the the value of a specific column in the where clause. I'm pretty sure these 5 pages could actually be 1 page, but not quite sure how. I will show the main page so you understand my meaning better: <div id="body_right"> <div id="content2"> <?php include ('library/tabs.php'); if(@strcmp($session->username,$req_user) == 0 || $session->isAdmin()) { // Call beginning of paging file $tbname = 'blablabla'; include ('library/paging1.php'); $sql = "SELECT blablabla_step1.*, blablabla_step2.* FROM blablabla_step1 LEFT JOIN blablabla_step2 ON blablabla_step1.al_uname = blablabla_step2.uname WHERE blablabla_step1.status = 'Send Offers' ORDER BY blablabla_step1.al_date Desc $limit"; $result = mysql_query($sql) or die('Error, list album failed. ' . mysql_error()); if (mysql_num_rows($result) == 0) { echo "No album yet"; } else { $total=mysql_num_rows($result); echo '<strong>' . $total . '</strong> result(s) found for the term: <strong>' . @$_POST['find'] . '</strong>'; echo '<table align="center" class="table_list">'; while ($row = mysql_fetch_assoc($result)) { include('library/database/contactview.php'); } echo '</table>'; } // Call end of paging file include ('library/paging2.php'); } else{ include ('library/not_logged_in.php'); } ?> </div> </div> So the red highlighted where statement is the only thing that changes, here is another example of one of the others below: WHERE blablabla_step1.status != 'Send Offers' AND blablabla_step1.status != 'Not Available' AND blablabla_step1.status != 'Fee Received' AND blablabla_step1.status != 'Awaiting Docs' AND blablabla_step1.status != 'Active' Any ideas how to combine these five pages? And can that where statement actually be written shorter as well? i have tried using ( ) but cannot quite figured it out.
  3. Hey Guys OK i've just launched the 3rd version of my companies website. Inside the admin section are pages calling mysql results. I am using the following code for my pages: <?php // which page should be shown now $page = (isset($_GET['page']) && $_GET['page'] != '') ? $_GET['page'] : 'horizon-recruitment-esl-home'; // only the pages listed here can be accessed // any other pages will result in error $allowedPages = array('pages are in here, and plenty of them'); if (!in_array($page, $allowedPages)) { $page = 'notfound'; } // Call header file which contains all meta tags, keywords, etc include ('header.php'); include $page. '.php'; ?> OK, now the trouble is, when i use any pagination script such as this: if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'>NEXT</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage'>LAST</a> "; } // if I cannot get past the first page. I have found that:( $_SERVER['PHP_SELF'] doesn't keep the included page path. For example: The user is at index.php?page=directory1/directory2/page1 Page1 has pagination, and is correctly only showing the first 20 results. When you click on the page 2 link, i am expecting this: index.php?page=directory1/directory2/page1&pageno=2 But what I get is: index.php?pageno=2 So i'm losing the entire path (page=directory1/directory2/page1). So 1) How do i keep that whole path?, and; now the second part of the question...Because I am already using "?" on the index page structure, do I now need to use "&" in the pagination script. I have tried using it (i swapped the php_self call for the full path), but i get a page not included error for anything past the first page. So, can anyone help me fix this? In the second version of the site i had a lot of duplicate code and pages to get the pagination working. I have learnt a fair bit more about how it works since then, and in the most recent version, i have about half as many pages/code. I am trying to keep from duplicating code as much as possible, the idea was to keep this version clean and tidy. Can anyone help me solve this, and perhaps explain the reason why the above problem is happening/alternative method for pagination? Thanks in advance.
×
×
  • 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.