Forums

This topic is locked

I need help...Please

Posted 22 Nov 2004 15:12:56
1
has voted
22 Nov 2004 15:12:56 Mashkur Alam posted:
Hi,
Last 1 month I was trying to solve a problem in my database, But no way, I couldn't manage it. Please any friend help me or advice me how can achieve this.:
Products Database:

1. products.asp . . . . holds the images of the products - SQL Distinct from products

2. manufacture.asp ...........holds manufacturers images ...... so here???

I am totaly confuse how can I can filter with products images by manufacturers images??? Even I created both pages, I can view the products images - with click on image when I go to next page (manufacuterer.asp) I can not see any images - no records......

Please Please any friend come to help me - it will be great learning point for me. If you want to see my pages I will email it to you. And any help would be appreciated.

Many thanks


Babu

Replies

Replied 22 Nov 2004 15:55:33
22 Nov 2004 15:55:33 Mashkur Alam replied:
Hi

I am again here, well basically what i need is

1. Products images on the first page which contains products images. By clicking image customer will go to detail page.

Question is: If I use SQL: SELECT DISTINCT prod_image
FROM products. Then how can I show the selected image products in next page? How can I extract all details of selected image?
(If customer choose one product e.g. mobile phone image, then in the next page how can I show my entire mobile phones collection?)


Please please help me, urgently, it is taking me long time to solve this problem. I hope any of friends will come to help me from this.

Many thanks

Babu
Replied 22 Nov 2004 17:40:18
22 Nov 2004 17:40:18 Simon Martin replied:
Hi

If your customer picks the mobile phone and you then want to show them all your mobile phones then your mobile phone on the 1st page is a category of product. So you should set up a category table and in the product table you will need to associate each item with a category id.
Then on your 1st page you can show a list (or pictures) of your categories (SELECT catID, catDesc FROM tblCategory)
Each link would pass the catID to the 2nd page - you can do this with the server behaviour in DMX
So on your 2nd page (SELECT * FROM tblProduct WHERE catID = varCatID) where varCatID is request.querystring("catID"
This filters your 2nd page so all records are available where the catID = the catID that was selected on page1 (eg all mobile phones)

Live the life you love
Love the life you live

Simon

[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
Replied 23 Nov 2004 14:26:32
23 Nov 2004 14:26:32 Mashkur Alam replied:
Hi
Thank you for your time and assitance.
A little bit confuse here, Assume that I need two tables to achieve the result. Catagory and Product. Data structure: Cataory: cat_id (primary key), cat_name, cat_image. Product: prod_id (Primary key), cat_id (Foreign key), prod_desc so on........ Until now am I in right way?

The question is: Shall I make relationship in two table? With cat_id (Primary_key), cat_id (Foreign key) Like that?

Look forward from you Simon.

Many many thanks



Babu

Edited by - babui on 23 Nov 2004 14:27:29
Replied 23 Nov 2004 19:33:47
23 Nov 2004 19:33:47 Mashkur Alam replied:
Hi Simon

I am nearly finish, just little bit confuse here:

In the Second page filtering:

(SELECT * FROM tblProduct WHERE catID = varCatID) where varCatID is request.querystring("catID"

My recordset is like:

SELECT *
FROM products
WHERE cat_id = cat_id???

VARIABLES = ?
DEFAULT Value = ?
RUN TIME VALUE = Request.querystring("cat_id"?


Am I in right track? Please look forward from you.


Babu

Edited by - babui on 23 Nov 2004 19:34:35
Replied 23 Nov 2004 21:21:58
23 Nov 2004 21:21:58 Simon Martin replied:
Hi Babu

Yes the data structure you've got there is fine; cat_id as foreign key in the products table is the correct way to make the relationship between the 2 tables. Make sure you've actually defined the relationship in the relationships screen as well as just having the names in both tables.

To create the recordset on the 2nd page it can be done in the simple view.
Where it says filter, select cat_id, then next to that the '=' sign
URL Parameter and finally type cat_id (this must match the name part of the link you created on the 1st page eg <a href = "page2.asp?cat_id=....
So the record set looks for the value cat_id passed to it in the url

You could also do it in the advanced window, which does offer you a bit more control -
Your SQL:
SELECT *
FROM products
WHERE cat_id = varCat_id

then below that sql box click the + sign and you then need to define your variable. I just like to stick var in front of the variable name so that I know its a variable (I also like to use tbl for table etc)
Then for Name call it varCat_id
Default value - 0 (so if no value is passed it wont throw back an error, you'll just get no records found)
Run-time value - request.querystring("cat_id"
as I said you could do all that in the simple view - the choice is yours

Live the life you love
Love the life you live

Simon

[DWMX 2004]|[SQL]|[ASP/VBScript]|[XP-Pro]
Replied 24 Nov 2004 13:15:03
24 Nov 2004 13:15:03 Mashkur Alam replied:
Hi Simon,

Thanks a million, its absolutely perfect, its working fine. With your kind help and advice I did manage to solve the problem.

Again thanks a million.

Babu

Reply to this topic