Re: [PHP-DB] comparison table script

2001-03-24 Thread JJeffman

Remember it only works on PHP4.0 !

HTH.

Jayme.

-Mensagem Original-
De: olinux [EMAIL PROTECTED]
Para: PHP-DB [EMAIL PROTECTED]
Enviada em: sexta-feira, 23 de maro de 2001 23:38
Assunto: Re: [PHP-DB] comparison table script


 Cool!
 Just came across this, looks like PHP will make life simple.

 http://www.php.net/manual/en/function.array-flip.php
 Array_flip() returns an array in flip order.

   Example 1. Array_flip() example

 $trans = array_flip ($trans);
 $original = strtr ($str, $trans);




 example:
 $a[0]="abc"; $a[1]="def";
 After an array_flip() you get:
 $a["abc"]=0; $a["def"]=1;

 gotta love it!
 olinux


  De: olinux  [EMAIL PROTECTED]
  Para: [EMAIL PROTECTED]
  Enviada em: sexta-feira, 23 de maro de 2001 12:37
  Assunto: Re: [PHP-DB] comparison table script
 
 
   You can get an idea here of what I would like to do
  
  
 

http://www.bestbuy.com/ComputersPeripherals/DrivesStorage/CDRW.asp?m=488cat
  =511scat=514
  
   So all information is displayed side by side, most of
   the time used to help decide between 2 or 3 products
   [bestbuy limits 10 selections in their comparison]
 


 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com


 --
 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]



-- 
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]




Re: [PHP-DB] comparison table script

2001-03-23 Thread olinux o

You can get an idea here of what I would like to do

http://www.bestbuy.com/ComputersPeripherals/DrivesStorage/CDRW.asp?m=488cat=511scat=514

So all information is displayed side by side, most of
the time used to help decide between 2 or 3 products
[bestbuy limits 10 selections in their comparison]

The array is the part I need help with. I am not sure
if what I had thought was the right track to pursue.

Thanks much,
olinux

--- Miles Thompson [EMAIL PROTECTED]
wrote:
 This isn't going to be the most helpful answer,
 because I'm wondering why 
 you'd want to do this in the first place.
 
 All you really have to do is create a new array from
 the existing result 
 set, transposing the columns.
 
 The number of elements in the array will be the
 number of car_ID's that are 
 returned, the number of rows in the array will equal
 the number of 
 attributes (columns) in the result set.
 
 Stepping through the result set and building the new
 array will be a rather 
 interesting exercise in nested loops as you will be
 repeatedly going 
 through the results set for each of ID, make, model,
 and color.
 
 After this array is built, then I'd worry about
 displaying it.
 
 Before that, however:
  Is it so important that the order of display be
 rearranged? Really, 
 what's the difference?
  What if 8 cars are returned instead of 3? What
 if 20? Your table will 
 blow out to the right, something users don't like.
  How do you plan to have users select the cars
 they want more 
 information about?
 
 Only you can answer these, and maybe you have. In
 which case, good luck.
 
 Miles Thompson
 
 

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
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]




Re: [PHP-DB] comparison table script

2001-03-23 Thread olinux

Cool!
Just came across this, looks like PHP will make life simple.

http://www.php.net/manual/en/function.array-flip.php
Array_flip() returns an array in flip order.

  Example 1. Array_flip() example

$trans = array_flip ($trans);
$original = strtr ($str, $trans);




example:
$a[0]="abc"; $a[1]="def";
After an array_flip() you get:
$a["abc"]=0; $a["def"]=1;

gotta love it!
olinux


 De: olinux  [EMAIL PROTECTED]
 Para: [EMAIL PROTECTED]
 Enviada em: sexta-feira, 23 de maro de 2001 12:37
 Assunto: Re: [PHP-DB] comparison table script


  You can get an idea here of what I would like to do
 
 

http://www.bestbuy.com/ComputersPeripherals/DrivesStorage/CDRW.asp?m=488cat
 =511scat=514
 
  So all information is displayed side by side, most of
  the time used to help decide between 2 or 3 products
  [bestbuy limits 10 selections in their comparison]



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
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]




Re: [PHP-DB] comparison table script

2001-03-22 Thread JJeffman

As you can only navigate record by record through the database table I think
the only way, as far as I know, is to store the record values into array
variables and print it to the page after you'd reached the last record.

HTH

Jayme.

-Mensagem Original-
De: olinux [EMAIL PROTECTED]
Para: [EMAIL PROTECTED]; PHP-DB [EMAIL PROTECTED]
Enviada em: sexta-feira, 23 de maro de 2001 00:52
Assunto: [PHP-DB] comparison table script


I would like to make a comparison script that will compare two items. Here
is an example and my "halfway" there solution. [at least i think so

Here is my table [for the sake of this example]

+-+
|  car_ID   |make   |   model   |   color   |
+-+
|  |   |   | |
|  |   |   | |
|  |   |   | |
|  |   |   | |
||_|||


I would like the user to be able to select two or more cars to be compared
[these will be passed from an html form as car_ID
Table will be laid out something like this.

+-+
|  |Car 1   |   Car 2|   Car 3 |
+-+
|  car_ID   |123  |234 |   345 |
+-+
|  make|honda  |   honda   |   ford |
+-+
|  model   |civic |   civic  |  tempo |
+-+
|  color |black   |   blue  |   red |
+-+

basically the table is just displayed with fields and records transversed
[switched]

Now i select the info for the two cars, and $result holds the finished query

OK now to display it.

the first while loop will write the rows.

$table = "TR";

while ($row = mysql_fetch_array($result)) {
   $carID = $row['carID'];
   $make = $row['make'];
   $model = $row['model'];
   $color = $row['color'];

$table .= "TDCar ID/TDTD$car_ID[1]/TD";

2nd while loop - writes TD's which vary based on number of carID's
selected
It will loop until all cars have been included

somehow i need to change $carID[1] to $carID[2]
so I need some help on the best way to do this...
After i am able to do this I will loop thru until it does not exist, in the
case of the table above it would be $car_ID[4]
$next will represent previous number of the array +1

/* start of second while or if/for loop */
if ($car_ID[$next] != "")
  $table .= "TD$car_ID[$next]/TD";

So basically that is as far as i have got. I would appreciate if anyone can
provide some direction

Thanks much,
olinux






-- 
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]