Jump to content

Archived

This topic is now archived and is closed to further replies.

Ninjakreborn

multiple search pages

Recommended Posts

[quote author=businessman332211 link=topic=102750.msg408320#msg408320 date=1154544966]
Ok here is the thing, I am developing something, I sort of understand the general theory.
I create my queries, limit it, at like 60 since there just links
so I would use limit 60
I know then on the other page, THe next query would be
LIMIT 60, 60
then
LIMIT 60, 120
that would telll it limit 60 starting at row 120, then on the next it's like
LIMIT 60, 180
and so forth, I know about this part, I also know how to get the links to appear, or I can come up with something, what I don't understand is do I have to create a physical page for each occurence.  Like do I have to create test
test1, test2, test3, test4, test5 and so forht, even if there not all used all the time
so it would show 60 on test 1, 60 on test 2 and so forth.
But that makes me also wonder because I have to do this same thing, in about 100 different areas, I have to make it paginate seperately for each category, sub-category, and when they run specific search criteria?
[/quote]

you would have to use fwrite? i think thats what you mean

Share this post


Link to post
Share on other sites
[code]umm wow i got lost there..but i think one of the things you said was searching through catagorys and displaying...i dunno but if so in the original code i had searching through catagorys working with paginating...i can show if you want...[/code]
any examples my help me formulate my idea better.  I have the entire system maps out except how to do pagination, except feeding it back on another page, and carrying category and sub-category with it, but then I have the issue of getting all the extra pages to appear on that page is well, and mantain the same information
hmm

Share this post


Link to post
Share on other sites
I have the framework laid out, I think i can get this to work, I can not populate my query, actually I have done, I am just testing it when I get back from taking my dog to the vet.  Next thing will be to try and get multiple pages to show up, I will come up with something for that, afterwards.

Share this post


Link to post
Share on other sites
[quote author=businessman332211 link=topic=102750.msg408807#msg408807 date=1154607261]
[code]umm wow i got lost there..but i think one of the things you said was searching through catagorys and displaying...i dunno but if so in the original code i had searching through catagorys working with paginating...i can show if you want...[/code]
any examples my help me formulate my idea better.  I have the entire system maps out except how to do pagination, except feeding it back on another page, and carrying category and sub-category with it, but then I have the issue of getting all the extra pages to appear on that page is well, and mantain the same information
hmm
[/quote]

heres my search code its got 1 catagory the only thing not here is the accual displaying of the numbers of pages...... but it shows that on my other code

[code]$pvs=$_GET['pvs'];
if(isset($_POST['submit']) OR $pvs != ''){
if(!empty($pvs)){
$search=$pvs;
$catagory=$_GET['c'];
}else{
$search=$_POST['search'];
$catagory=$_POST['catagory'];
}
$display = 10;
if($catagory !== "All_Catagorys"){
$counting = "SELECT COUNT(*) FROM listings WHERE title LIKE '%$search%' AND cat='$catagory' OR  description LIKE '%$search%' AND cat='$catagory' ORDER BY id ASC";
$showing = "SELECT * FROM listings WHERE title LIKE '%$search%' AND cat='$catagory' OR  description LIKE '%$search%' AND cat='$catagory' LIMIT $start, $display";
}else{
$counting = "SELECT COUNT(*) FROM listings WHERE title LIKE '%$search%' OR  description LIKE '%$search%' ORDER BY id ASC";
$showing = "SELECT * FROM listings WHERE title LIKE '%$search%' OR  description LIKE '%$search%' LIMIT $start, $display";
}


$page = "$counting";
$resultp = mysql_query($page);
$row = mysql_fetch_array($resultp, MYSQL_NUM);
$num_records = $row[0];

echo "<p align=center>There are $num_records Listings</p>";
if(isset($_GET['np'])){
$num_pages = $_GET['np'];
}else{
$page = "$counting";
$resultp = mysql_query($page);
$row = mysql_fetch_array($resultp, MYSQL_NUM);
$num_records = $row[0];
if($num_records > $display){
$num_pages = ceil($num_records/$display);
}else{
$num_pages = 1;
}
}
$query2="$showing";




}[/code]

Share this post


Link to post
Share on other sites
I can strip this down some in my own application if I run into a road block, until I get my application running thouroughly but I realized just now some of my older scripts have problems(not problems) but I forgot to add in a few features that were asked I am going to try to get those situated right now.

Share this post


Link to post
Share on other sites
[code]<?php
$connect = mysql_connect("localhost", "#####", "######");
$select = mysql_select_db("elostand_general");
$directory = split("/", $_SERVER['PHP_SELF']);
$category = $directory[1];
$subcategory = $directory[2];
$newarray = explode(".", $subcategory);
$subcategory = $newarray[0];
$select = "SELECT * FROM foundpostings WHERE category = '$category' AND subcategory = '$subcategory';";
$query = mysql_query($select);
while ($row = mysql_fetch_array($query)) {
echo "<a href=\"/view/foundpost/{$row[foundpostid]}\" target=\"_blank\">{$row[generictitle]}</a>";
$test = true;
}
if ($test != true) {
echo "<span class=\"logspan\">";
echo "I apologize but your current search did not yield any results.<br />";
echo "Please try your search again, or nothing came up with this search<br />";
echo "criteria<br />";
echo "</span>";
}
?>[/code]
Ok this is the system I set up now, the redirects work, everything populates properly.  I need to ask something now, here is when I need to ask a question.
The thing now is the pagination, I may not even need it, I could probably populate 100-200 per set, but eventually the site may get big enough to get bigger than that, but for now, what direction should I gear this to paginate.

Share this post


Link to post
Share on other sites
quick help here, anyone with big guns or big balls.
Anyone with pagination experiences.
Ideas, hints, tips, and tricks welcome.

Share this post


Link to post
Share on other sites
nevermind I nixed pagination until the site get's bigger, it can just live with whatever number of queries per page.  because of this price on this project, I am only putting int he necessities, and at 100 post's per page, I don't need to worry about it displaying anything, so I will set it up like this for now, and integrate pagination later on.

Share this post


Link to post
Share on other sites

×

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.