Are the fields always the same?
Ive used something similar, I usually fill an array with selection ids when
while loop them into querys-> To get the table I ussualy create a container
table(one cell) and generate tables inside the container one for each item.
From: olinux [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 16, 2001 1:43 PM
To: PHP-DB; [EMAIL PROTECTED]
Subject: [PHP-DB] dynamic columns
I would like to put together a script that results similar to
www.bestbuy.com 's compare feature. Basically if you are looking in an item
category you can select check boxes for each item you would like to compare.
The results display like this;
ITEM 1 ITEM 2 ITEM 3
So the problem for me in creating this is, how do you accomodate for
sometimes 2 items, and sometimes 3 or 4 being selected? It would be easy to
show the table reversed (with fields at the top), but i like the way it is.
I have thought about it and wonder if something like this would work. (my
code will be sloppy... but just to give an idea)
SELECT * FROM item_table WHERE item_ID = \"$item_ID\"
This would grab all of the records for the item ID's passed [which are
passed from the checkboxes]
We would also need to get the field names. I will assume that we have
these. And then we need to use a while loop to get all variables. Now we
need to display it. The following would go at the end of the while loop
/* $item_1_1 indicates the property of item 1 that corresponds to field_1
$item_1_2 indicates the property of item 1 that corresponds to field_2
/* Now here we put an if statement that counts the number of records that
were displayed and doe something based on that number */
$comparison_table = "
I don't know! Now I am lost, please help me if you can.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]