/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Search database Help

Here we go i am a training webdesigner i have done basic php and have made a search engine for my database and even impressed my teacher as he could not break it..

What i need is help finding information / tutorials to help me do two things

1.) If i get a 100 results from my search, i want to make it so it goes over many pages with say 10 results on each page and have the page – 1 – 2 – 3 at the bottom which are links to the next page with the rest of the results on.

2.) How to make it so when you click on one of the search results it brings up the product information into a template, so i only have to make one template that all the product details use to add the infomation to when the product is clicked on from the search..

If that make sense, most online shops use these features but my course has not taught us this indepth and books on the subject are hard to find when you are not sure of the name of the feature you want to create.

Any help would be most helpfull…..

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@foxbeeflyJul 26.2007 — For question 1:

You are looking for a technique referred to as "pagination". There are plenty of tuts on the web to do this - here is one:

http://php.about.com/od/phpwithmysql/ss/php_pagination.htm

For Question 2:

1) Create a basic page (template as such) that will display the info about a product by querying the database using most likely the unique product number.

2) The link that you click on on your results page uses GET to pass the product number (of the prduct you want to se more of) to the product template page you created in 1) - the product page uses this number to query the database and display the relevant info. The link on th search results page would look something like this:

<a href='product_template_page.php?product_id=".$product_id."'>Name of product (click for more info)</a>

On your product info template page, a query something like:

'SELECT * FROM products_table WHERE product_id = ".$_GET['product_id'].";'

Then display the resulting record.

I used another technique to combine pagination with some DHTML here (click on the name of a wine to get a pop-up with more details of the specific wine):

http://www.stylus.co.za/wlist_paginated.php
Copy linkTweet thisAlerts:
@mrtom100authorJul 26.2007 — Thank you very much it is easy when you know the name of the process lol... all the books i have tried to find all cover the same stuff, the basics to using sessions and thats it...
×

Success!

Help @mrtom100 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...