Gossamer Forum
Home : General : Perl Programming :

some input please

Quote Reply
some input please
Hi,

Ok..I'm looking for a little input on what I'm going to be doing. I'll try to explain as easy as possible. I have to display three records on one detail page. Each of these records can be combined and will produce different output. I have a grasp on what I need to do, but I'm wondering if there's a simpler way to do it. Let me give an example. (A-E, 1-10 and a-j stand for product names, but to keep it simple I'll use letters/numbers)

Record 1/Option 1 (This record has 5 options...each one is a different number value, description, name, etc)
A, B, C, D, E

Record 2/Option 2 (This record has 10 options...each one is a different number value, description, name, etc)
1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Record 3/Option 3 (This record has 10 options...each one is a different number value, description, name, etc)
a, b, c, d, e, f, g, h, i, j

Lets give some examples of values and descriptions:
A= 300 - description is "the biggest one"
1= 50 - description is "the medium one"
a= 25 - description is "the smallest one"

Now...a user selects option A, 1 and a and they are taken to a link which will go to the details page which prints the following:
Thanks for choosing A, this is the biggest one.
You also chose 1 which is the medium one.
You also chose a which is the smallest one.
The total value is 375 (which is all the totals added together)

I can do this with links easy enough, but the problem is I need to input too many records. The above output basically is one record. I would need to input a record for each option, so if a user selects A, 2, a this would be the second record and have different values/output then the first, if a user selects A, 2, b this would be the third record and have different values/output then the second, if a user selects A, 2, c this would be the fourth record and have different values/output then the third.....etc, etc...you get the idea. I might attempt to use links or dbman, but if you have another recommendation that would be great! So here is what I'm trying to do:

1) Calculate and print 3 seperate values/records/links to one details page...so think of it as combining 3 links. (the user will always select 3 records/options)
2) Minimize the input that I need to do.

I think a shopping cart would be the best route to go, but I'm looking for other ideas. I know it's a little confusing, so if you need more info let me know. Thank you for your input!

Quote Reply
Re: some input please In reply to
This could probably be accomplished through using the Relational Mod for DBMAN, yet in terms of data processing, it would be quite slow with a flat file system.

The better suggestion is to use either DBMAN SQL or LINKS SQL and then create three different tables. In two of the tables, the foreign key will be the ID from the main record table.

Like the following:

Option1_Table

ID
Field1
Field2
Field3

Option2_Table

ID
Field1
Field2
Field3

Option3_Table

ID
Field1
Field2
Field3

The RED ID fields denote the foreign and primary keys of the three tables.

Then you would use the built-in query functions in either of the SQL products to pull data from the three different tables based on the options that the USER inputs.

Regards,

Eliot Lee
Quote Reply
Re: some input please In reply to
Thanks for the input Eliot. With the sql version, can you print all of the three "Options" on one page? The only problem is I'd have to switch hosts (I can't use sql with my current host) which would be a nightmare, because the site is huge! I've heard tables referenced before, but I'm not sure what they actually are....I've never used any sql products, but I should definately look into them. Basically, if comparing with links, I'm trying to print three seperate links/records on one detail page and then total the three pre-determined number fields. I'll take a look at that relational mod also. Thanks again.

Quote Reply
Re: some input please In reply to
In Reply To:
With the sql version, can you print all of the three "Options" on one page?
Yep...all you have to do is query all three tables based on a common field like a foreign key (ID), then you can print values from all three tables.

In Reply To:
I've heard tables referenced before, but I'm not sure what they actually are....I've never used any sql products, but I should definately look into them.
You can think of "tables" as separate "db" flat files. Yet they are contained in ONE database. You could, of course, have multiple databases with multiple tables of data.

In Reply To:
Basically, if comparing with links, I'm trying to print three seperate links/records on one detail page and then total the three pre-determined number fields.
Right...and if you go with a flat file system, be prepared for slow data processing. And basically, you are looking for multiple data storage units (either multiple database flat files or multiple tables within in SQL applications, like MySQL or MSQL).

Good luck!


Regards,

Eliot Lee
Quote Reply
Re: some input please In reply to
Ah...ok, got it now! I just read over the relational mod by jpdeni. Yeah, the best bet would probably be to use the sql version....I would just need to find a new host though....bummer. :-3
In Reply To:
Yep...all you have to do is query all three tables based on a common field like a foreign key (ID), then you can print values from all three tables.
This is a very cool feature though....probably makes management alot easier. Thanks again.

Quote Reply
Re: some input please In reply to
In Reply To:
probably makes management alot easier
Yep...I will never go back to flat file sytems again...there are so many robust functions in MySQL that are a lot easier to code like for example, if you want to open a flat file to print data, you will probably have to write between 5 and 10 lines of code...in MySQL using Perl or PHP, it is only about 1 - 2 lines of code.

Also, it is a lot easier to set up relations between different data sets or tables...a lot easier than hacking flat file driven scripts...and you don't have to worry about the following with SQL applications:

1) File permissions - You don't have to continually check to make sure that flat files are set correctly.

2) Locking Files (flock) - you don't have to worry about locking files for writing and deleting data.

And there are many other advantages...I encourage everyone to seek SQL solutions rather than using flat files...too many headaches if you ask me.

Now, keep in mind, that there is a learning curve associated with MySQL...but if you have a good Perl programming background and if you understand basic concepts of database design, then it is easy application to grasp...

And with applications like LINKS SQL and DBMAN SQL, a lot of the work is already done for you. Especially with the NG version of LINKS SQL (v.2.0), it is real easy to set-up and also customize through its built-in plug-in system.

Regards,

Eliot Lee
Quote Reply
Re: some input please In reply to
Hey, thanks for that helpful info. I'm definately going to consider stepping up to sql versions. I've been considering it for such a long time, but not really looking forward to re-writing all of the custom mods I've added, plus all the other ones I've added that other people have contributed. I know you've been working on switching yours over---and have done alot of changes...I haven't stopped by your site in awhile, how's it coming along? It might be worth just paying someone to do all the conversions---unfortunately, I just don't have the time to dig into it myself! When I'm ready to commit to the change, I'll post a message in the "custom job forum"....and if you have anyone in mind that's up to this type of job, let me know! Thanks again. See ya.

Quote Reply
Re: some input please In reply to
In Reply To:
I haven't stopped by your site in awhile, how's it coming along?
Phase I of upgrading the "Library" section of my site is completed.

Phase II of upgrading other sections to MySQL using central core modules of Links SQL is almost complete.

Phase III of integrating user access to the different sections of my site will be completed by Feb.2000.

Thanks for asking.

In Reply To:
When I'm ready to commit to the change, I'll post a message in the "custom job forum"....
That would be best.

BTW: It took me two months to upgrade 80% of the Mods I installed in Links 2.0 to LINKS SQL v.1.11. And since there seems to be a lot of work to be done with LINKS SQL v.2.0 with user management features, I probably will not upgrade to the NG version of LINKS SQL for a long while.

See ya.

Regards,

Eliot Lee