Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

one recordset - dynamic queries

Guest
Aug 01, 2006 Aug 01, 2006

Copy link to clipboard

Copied

I'm very much a beginner with dynamic web apps, but I've managed to create a simple catalog. I created a recordset that selects all of the products and displays them on the page. I'd like to divide the products into categories by using different query criteria in my recordset, and I started to do this by creating a different php files for each page... very tedious and does not seem very efficient. I figured that there is a much better way to do it but I really don't know what it is.

click here to see the work in progress

Ideally, I'd like the links in the category menu to somehow modify the recordset and display the new list of products accordingly. I'm sorry if this is already in the archives but I have no clue what to search for.
TOPICS
Server side applications

Views

366
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 01, 2006 Aug 01, 2006

Copy link to clipboard

Copied

It's all in the database. :)

You would create a Categories table and that would have an ID number that
would assign automatically and a Category that would contain the name of the
category. You could then display those on your page with a select all
recordset and a repeat region .. and make them links that would link to the
products of that category by making the CategoryID the filter of the
recordset on the product display page.

In your products table you want to add a column for the Category ID and put
the Category ID that each product belongs to in that column. That is called
the "foreign key" and can then be used in your query to select Products
WHERE CategoryID = 1 or whatever.

Make sense?


--
Nancy Gill
Adobe Community Expert
BLOG: http://www.dmxwishes.com/blog.asp
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner's
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development


"irvb" <webforumsuser@macromedia.com> wrote in message
news:eanid1$gvc$1@forums.macromedia.com...
> I'm very much a beginner with dynamic web apps, but I've managed to create
> a
> simple catalog. I created a recordset that selects all of the products
> and
> displays them on the page. I'd like to divide the products into
> categories by
> using different query criteria in my recordset, and I started to do this
> by
> creating a different php files for each page... very tedious and does not
> seem
> very efficient. I figured that there is a much better way to do it but I
> really don't know what it is.
>
> click here to see http://www.bwdusa.com/all_products.php
>
> Ideally, I'd like the links in the category menu to somehow modify the
> recordset and display the new list of products accordingly. I'm sorry if
> this
> is already in the archives but I have no clue what to search for.
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2006 Aug 02, 2006

Copy link to clipboard

Copied

Thanks a lot for the reply.

I, being the beginner that I am, cannot figure out how to link the tables. I've been trying to do this using PHPMyAdmin that my hosting company provides. It didn't even give me the option to create a link or relationship or foreign key. I read online that the PHPmyadmin Relationship support is disabled on many webhost's servers, so I installed my own version of PHPMyAdmin on the server with the pmaDB options enabled... still can't do it. I spent the whole day trying to figure it out yesterday reading tutorial after tutorial and I still haven't gotten anywhere.

Does Dreamweaver 8 have the ability to create tables and foriegn keys from table to table? Or are there other ways of doing it?

I'm really desperate to get these relationships working - it seems like a key element in having an efficient dynamic website, and I'd like to have that ability.

thanks in advance for any help

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 03, 2006 Aug 03, 2006

Copy link to clipboard

Copied

LATEST
Okay I've given up on the linking tables thing... I guess I'm not ready for that. (I do appreciate the response though)

I'm currently trying to use a variable ($varcat) for the WHERE value in my recordset query.

"SELECT * FROM Product WHERE category = '$varcat' ";

and earlier in the code the variable is defined with: $var_cat = "";

I'd like a menu link to give this variable a value like 1,2, or 3
and this would display the new results in my dynamic table repeat region.

Is this as easy as it seems? I feel like I'm close... but then again probably not.

thanks for any replies
Irv

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines