Jump to content


Photo

multiple search pages


  • Please log in to reply
32 replies to this topic

#1 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 06:11 PM

Now it's time for me to figure out how to set up a search area, that adds pages for items over 20.  I am wanting to drop a list of about 100 links on a page, leading to various post's then when it get's to 100 I am wanting to cut it off, and start showing page 1, and page 2, excetera , if there were like 600 posts, then there would be 6 pages, and so forth, any advice??  Or a place to start, I know everything I need to know about db calls, it's just figuring out how to get the other page to dynamically create based on the number of posts?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#2 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 02 August 2006 - 06:13 PM

heres my script that i use for a marketplace....it has paginating on it... EDIT: I have cut out alot of code to help narrow down the paginating

<?PHP
if(isset($_GET['s'])){
$start=$_GET['s'];
}else{
$start=0;
}
$display = 10;
$counting = "SELECT COUNT(*) FROM listings ORDER BY id ASC";
$showing = "SELECT * FROM listings 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";




if($num_records > $display){
$num_pages = ceil($num_records/$display);
}else{
$num_pages = 1;
}


if ($num_pages > 1){
echo '<br><p>';
$current_page = ($start/$display) + 1;
if($current_page != 1){
echo '<a href="browse.php?s'.($start - $display).'$np='.$num_pages.'">Previous</a> ';
}
for($i =1; $i <= $num_pages; $i++){
if ($i != $current_page){
echo '<a href="browse.php?s=' . (($display*($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';
}else{
echo $i.'';
}
}
if($current_page != $num_pages){
echo '<a href="browse.php?s='.($start + $display).'&np='.$num_pages . '">Next</a> ';
}
}
?>
</html>

"Syntax error" .. WHERE THE **** IS IT?!

#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 06:15 PM

thanks, gives me something for an example.  thanks

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 06:56 PM

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?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:05 PM

See this is my fear.  I have to get  a search set up, and there are a lot of categories and sub-categories, I will probably some how find all of them to run through one page, I normally come up with something, but I have to get them all working with paginate< i am brainstorming idea's right now, but in case I can't come up with something there is no way I could have 10 physical .php locations for each occurence, to check for all possible numbers.  I have to find a way to autogenerate the queries, on the other pages, without creating physical manifestations of those pages, for each set of queries. Like 10 pages for each category, 10 for each subcategory, that will range around 250 pages total by the time I am done, with like 20-175 that aren't in use most of the time.  THen if the queries get larger than that, then I don't have enough pages to cover it.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:13 PM

also I just got an idea.
I can put the page back onto itself.
For instance I can have a query
and inside the query I can limit it to 10, and capture the result, using count, or num_rows, to get the number of row's I have.  THen when the links are clicked, it sends it back on itself, containing a variable in the url, that populates the query.  Then the query just get's repopulate on itself, and upgrades it's number's over and over again.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#7 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:22 PM

Actually I have an idea for the framework at least.
I will take and pull the url, I will cut it up, and pull out the individual information to retrieve the category, and subcategory it's coming from, then I can populate my search using that category and subcategory.  That will take care of that issue.  Then for my pagination, I can contain another variable, that is going to record the number of rows, then based on the number, i can display the appropriate number of links.  Then those links, feed it back onto itself, and they should repopulate the mysql query again with teh proper numbers to display, the onyl thing is, I have to find a way to keep it from repopulating some random for category and subcategory.  I just have to prevent it, because hte url won't contain the category or subcategory anymore so it might end up running an emtpy query and breaking the whole thing, I have to consider that too.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#8 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:27 PM

I might be able to temporarily store them in sessions, with just like a 15 second lifespan.  Then that will keep the category and subcategory saved just long enough for me to be able to repopulate my fields.  I might be able to get it to run smoother like that. 

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#9 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:39 PM

I am setting up the frame work to split the directory information to retrieve the category and subcategory now, once I get it working, I am going to make sure the variables are passing, then redo all my links to point to that same page, for all the found items.  Then after I have them all running towards it, I will write a general query and populate it with category and subcategory based on the link directory.
After that I am going to try and see about saving the number of rows, and using if statements, or a case switch probably to test the number of total result's so I can produce the appropriate number of links.
Then I can try to dynamically set the numbers to work with when it repopulates the query, then all I ahve to figure out is how to carry over category and sub-category, with some modifications I can probably dynamically populate it through each url, to come back on itself, but then it might conflict with me splitting the directory.
hmm

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#10 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 02 August 2006 - 07:42 PM

;)

Sounds like you're slowly working it out.

Good luck... :)

#11 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:48 PM

Thanks.
I just figured out one thing.
I am going to ahve one page to recieve the information coming from category and sub-category to populate my query, like view 1.  Then all of those links, ALL of them are going to point to view 2, the links that show more.  The will go to view 2.  I will pass the category and subcategory via get to the other page, as well as the number of row's that I left off on, and the limit number, which is whatever I choose to limit it at.  THen for each link, I can easily pass through all the variables.  I can make the links go up to like 10 pages, that will make sure that it atleast lasts for awhile, if I have number problems I can probably, go back and just add a few more pages as needed. 10 pages should last for the lifetime of the site atleast.  That would be a lot of posts per category, especially if I make 100 the limit, it should keep things running smoothly for quite a long time, but then I also have to sort based on the entry date, actually I made a miscalculation during entry, I have to record the date's they were entered to, just not a date that keeps getting updated.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#12 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:49 PM

well I could sort by id number too.  Because the newest numbers would have course been entered first, I have to do something about the entry date anyway, it has to show the date they were entered so people atleast know when it was entered.  I have to work that out first.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#13 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 07:59 PM

Ok I just fixed all the issue's relating to the date, now it records the date, and shows the date, and email's the date, I redid all of that, now I can concentrate on making this work.
I am going to go ahead and work up all my categories and sub-categories, and hte page to recieve those requests.  Then I am going to set up the directory splitter, and cut it up to recieve the category and sub-category.  Then display 100 results, and start recording the information I need and display the pages.
I have accounted for everything except one thing I forgot, I have to get the number of pages as well to produce on the other page, so they can be viewed.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#14 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 08:16 PM

ok now I could use some help, I know how to set up redirects and they normally work well.  The thing with this is it's acting up, when it activates the redirect in order to get out of it you have to click on a link 2 times
like
this is my htaccess
Redirect /found http://www.elostandfound.info/viewfound.php
Now the folders are like that, when they choose a category, then the sub-category it redirects to
http://www.elostandf...ory/subcategory
just like that in the url, taking me to the page I need, and giving me the info from the links I needed to get the process to start.  But when you try to click on another page, for instance the homepage, or the account page.  It does something wierd, like if I click the account page the first time it becomes
http://www.elostandf...p/myaccount.php
and if I click the homepage first instead it's
http://www.elostandf...d.php/index.php
it starts to chain it, the first link you click on changes the url to match the name of the page, then whatever else you click on after that takes you out of the page, why is this happening?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#15 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 09:06 PM

advice anybody?

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#16 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 02 August 2006 - 09:10 PM

i see that you have the links like this
<a href="../index.php">Home</a>
Well the browser actually thinks that http://www.elostandf...d.php/category/ is a directory and tries to go to http://www.elostandf....php/index.php.

if you do this instead:
<a href="/index.php">Home</a>
then the browser knows that you're accessing the index.php of the top level.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#17 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 09:16 PM

that works but when going deep on some pages, the only way access seems to work is if I use ../
but I will try that now and see if it works.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#18 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 02 August 2006 - 09:19 PM

then you can do /level1/level2/page.php
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#19 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 09:23 PM

wait, I was ALWAYS taught, that if you are on the root folder you can access everything on the same, even if your in a sub-folder you can use just
whatever.php
but if you were in a sub-directory calling a page in the root directory it was
./whatever.php
and then 2 levels deep was
../whatever.php
are you tell me all I have to do is put
/whatever.php
and I can access the link from any page???

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#20 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 02 August 2006 - 09:24 PM

because I always have trouble getting access to my css pages, when I am a couple of levels deep in a directory I thought I always had to put ../

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users