Search Results

Search found 2 results on 1 pages for 'newsouser'.

Page 1/1 | 1 

  • What is the best way of doing this?

    - by NewSOuser
    Hey, I am wondering how exactly the below pagination systems are set up? In terms of the how the data is displayed, for instance, does BuySellAds load all results in from database and then paginate that data so filter can be done easier? or, do they call the database every time a new page is loaded and then grab the info and display it? I really would like to know how both BuySellAds and Nike make their pagination systems, since I have to make a similar system that has many filters and options to easily sort through the data from a database. I want to accomplish this with php and jquery if that's what I even need to use. Here is what I am talking about so you can experience it for yourself: BuySellAds store.nike.com Any info/suggestions would be great. Thanks for your input.

    Read the article

  • How to allow multiple filters to be selected - pagination?

    - by NewSOuser
    Hey, I am still trying to allow multiple filters to be selected for my pagination script but not sure how to do it being very new to php and programing in general. So in my pagination, when a user clicks the 'marketing' button(link) it queries the database just for the category that = marketing. The same goes for the other 2 filter buttons as seen in the script below. (automotive, sports). The problem is, I want to be able to select multiple filters like only marketing and auomotive or automotive and sports, for example if I click the marketing filter and then the automotive, it would display the categories that equal marketing, and automotive. I have no idea how to accomplish this, so I have come to the experts to help me out. This is the script I am working on: <h3>Filter results by:</h3> <a href='pagi_test.php?category=marketing'>marketing</a> <a href='pagi_test.php?category=automotive'>automotive</a> <a href='pagi_test.php?category=sports'>sports</a> <br /> <h3>Results:</h3> <?php //connecting to the database $error = "Could not connect to the database"; mysql_connect('localhost','root','root') or die($error); mysql_select_db('ajax_demo') or die($error); //max displayed per page $per_page = 3; //get start variable $start = $_GET['start']; $category = mysql_real_escape_string($_GET['category']); //count records $record_count = mysql_num_rows(mysql_query("SELECT * FROM explore WHERE category='$category'")); //count max pages $max_pages = $record_count / $per_page; //may come out as decimal if (!$start) $start = 0; //display data $get = mysql_query("SELECT * FROM explore WHERE category='$category' LIMIT $start, $per_page"); ?> <table width="800px"> <?php while ($row = mysql_fetch_assoc($get)) { // get data $id = $row['id']; $site_name = $row['site_name']; $site_description = $row['site_description']; ?> <tr> <td><?php echo $id; ?></td> <td><?php echo $site_name; ?></td> <td><?php echo $site_description; ?></td> </tr> <?php } //setup prev and next variables $prev = $start - $per_page; $next = $start + $per_page; //show prev button if (!($start<=0)) echo "<a href='pagi_test.php?category=$category&start=$prev'>Prev</a> "; //show page numbers //set variable for first page $i=1; for ($x=0;$x<$record_count;$x=$x+$per_page) { if ($start!=$x) echo " <a href='pagi_test.php?category=$category&start=$x'>$i</a> "; else echo " <a href='pagi_test.php?category=$category&start=$x'><b>$i</b></a> "; $i++; } //show next button if (!($start>=$record_count-$per_page)) echo " <a href='pagi_test.php?category=$category&start=$next'>Next</a>"; ?> Any help on this would be great. Thank you. -- EDIT -- If anyone has a better method of doing a pagination system with multiple filters than the one above, please let me know.

    Read the article

1