Skip to main content
Participating Frequently
Jul 26, 2006 7:00 PM UTC
Question

Data Issue

Hi,

I am doing a dynamic application for a company that sells printers. I am using MySQL and PHP. On the first page, I need to list each printer series and the features of the series. This is my problem - They had an internal database that has each printer listed in it, along with the printer series it belongs to and the features of each series - it is all in one table. So even if two printers belong to the same series, with same series features, it is repeated - no separate linked table for the series and its features.

This is what I cannot figure out. The printer item number is listed and each of the features has it's own column. So if a printer has a certain feature - it gets a "YES" in the database table. There are about 20 features that each printer item may or may not have. How do I write a record set that pulls up any features that has a "YES" for that series, but on the actual page print what the feature is? So if my printer item number 1000 has YES in the "doub_tray" column and "YES" in the "duplex" column, how do I get it to list:
FEATURES:
* DOUBLE TRAY
* DUPLEX PRINTING

on the actual web page? Will I have to have a separate recordset for each feature??

Thanks!
This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Inspiring
Aug 18, 2006 2:37 PM UTC
did you test it an is it working?

<tryign to hide my surpise> ;o)


"tccdover" <webforumsuser@macromedia.com> wrote in message
news:ec2s2r$cje$1@forums.macromedia.com...
> Excellent! Thanks!!!


Translate
tccdoverAuthor
Participating Frequently
Aug 17, 2006 10:54 PM UTC
Excellent! Thanks!!!
Translate
Inspiring
Jul 26, 2006 7:30 PM UTC
You should be able to pull in all of your printer records in one SQL
statement, and then seperate them out programatically.

I started on some code below, but probably need to know more before we go
further.

1. Do you know what printer categories you have, or are they generated from
a list? Or are they just entered into the printer descirption? Are they
standard, defined, or just a text field?

2. How are the printers being printed on the page? Do you have an example
page? Can you show me what you *want* to do or what improvements you're
wanting to make over an existing page?

3. It sounds like you just need to list the *series* of printers, not the
actual printers themselves, is this true? You just want to show what each
series has?

/*This function will add features to an array */
function add_feature($feature){
if ($featureName == "YES"){
features[] = $featureName;
}
return features;
}

//This will loop through your recordset to get all of your informaiton and
sort it out.
do{
$printerID = rs info;
$double_tray = rs_doub_tray
/* Set all of your variables in your do statement. You could also use an
"extract" but it's easier this way with DW recordsets, I think */





"tccdover" <webforumsuser@macromedia.com> wrote in message
news:ea8e4b$7b9$1@forums.macromedia.com...
> Hi,
>
> I am doing a dynamic application for a company that sells printers. I am
> using MySQL and PHP. On the first page, I need to list each printer
> series and
> the features of the series. This is my problem - They had an internal
> database
> that has each printer listed in it, along with the printer series it
> belongs to
> and the features of each series - it is all in one table. So even if two
> printers belong to the same series, with same series features, it is
> repeated -
> no separate linked table for the series and its features.
>
> This is what I cannot figure out. The printer item number is listed and
> each
> of the features has it's own column. So if a printer has a certain
> feature -
> it gets a "YES" in the database table. There are about 20 features that
> each
> printer item may or may not have. How do I write a record set that pulls
> up
> any features that has a "YES" for that series, but on the actual page
> print
> what the feature is? So if my printer item number 1000 has YES in the
> "doub_tray" column and "YES" in the "duplex" column, how do I get it to
> list:
> FEATURES:
> * DOUBLE TRAY
> * DUPLEX PRINTING
>
> on the actual web page? Will I have to have a separate recordset for each
> feature??
>
> Thanks!
>
>


Translate
tccdoverAuthor
Participating Frequently
Jul 27, 2006 3:06 AM UTC
Hi!
Thanks for the detailed reply – I added more information, hopefully it will clarify my problem:

Each entry in the database is essentially an entry for a printer item number. Each item number has both a model number (model numbers can have more than one item number, depending on how many ink cartridges and such they may have) and a printer series number. I start with the Printer Series page – which lists out all the different series and some basic features of the series. This page was fairly easy because the features of the series have actual values – like duty_cycle has a value of 2000, so I can list Duty Cycle on the page and have the value come up next to it. This page also lists all the models that belong in the series and then has links to the information about each model.

This is where I get a bit confused (okay, a lot confused!) The features of the models are more like yes and no questions – does it have security locks? Yes or No. So for each feature the column would be labels like this “secr_locks” and the value in the column would either be Y or N. If the answer is Y, I want it to print on the page “Security Locks” under a heading I have put statically on the page that is called “Features” For each column that has a Y in it, I want it to list the real wording of the feature – one after another in a list form.

I guess I am looking for a way to say: If “secr_locks” = Y, then print “Security Locks” for each feature in a certain model. Does that make sense?
Thanks!!
julie
Translate