Ninjakreborn Posted September 19, 2006 Share Posted September 19, 2006 I put it off on an older project. I didn't know how at the time, and that site won't need it for a long time. This one however, is a project I have no choice but to use that on. Expcept that the layout behind hte programming is like 8 search results for each section, on one page.In a giant case switch statement[code]<?php // get together the critical variables, and clean them up. $postset = mysql_real_escape_string($_GET['ps']); $school = mysql_real_escape_string($_GET['s']); $category = mysql_real_escape_string($_GET['c']); $subcategory = mysql_real_escape_string($_GET['sc']); // go through databases. Easier to keep up with, let's start with database number 1 switch ($postset) { // Work with database postset1 case "postset1": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset2 case "postset2": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset3 case "postset3": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset4 case "postset4": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset5 case "postset5": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset6 case "postset6": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset7 case "postset7": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; // work with database postset8 case "postset8": $select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school';"; $query = mysql_query($select); if ($row = mysql_fetch_array($query)) { } break; }?>[/code]looking on this, it is obvious I haven't actually started working with displaying yet. I have 2 things I am having to do here, and neither one of them I am 100% sure on how to do. I am going to pull just the title of the title out and display it(that will be the results), but it will be a link going to one of the results page. That part is easy, just have it appear as a link, and past the post id to one of the 8 table handlers. I have 8 pages, 1 for each table results, or maybe even 1 page with another switch statement to handle them all, whatever, that's easy. For this though, on this page, I am just shwoing the title of the post. That is also pretty easy. Now here comes the difficult thing, I have 2 goals i have to accomplish and I am not sure howThese are related to this 1 page1. Seperate them by date. I have the date saved in the database, of when they were posted, but I am unsure, (sort of like craigslist), to allow them to show a date, everything for that date, show the next date, and everything for that date. That type of setup. Then after 30 days the admins clear it, and the ones older than 30 days are dropped2. Pagination, I want to show about 1-200 per page. And hten have multiple pages, based on the number of total search results. Quote Link to comment https://forums.phpfreaks.com/topic/21307-pagination-and-dated-layout/ Share on other sites More sharing options...
Ninjakreborn Posted September 19, 2006 Author Share Posted September 19, 2006 I was told earlier something about session arrays.Can I save this information in a sessionlile$_SESSION['pagination'] = array()and set the array with the different variables for count and stuff. I was thinking about this now, because if I can, and it will keep it seperate totally from the logged in related sessions, then I think it would be a good idea. Then again, won't it make them come back to those search pages, everytime. Is there a bad thing about setting it up this way. Quote Link to comment https://forums.phpfreaks.com/topic/21307-pagination-and-dated-layout/#findComment-94904 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.