Re: [PHP-DB] Is this possible?

2002-02-06 Thread Raymond Lilleødegård

My table look like this:

Pricetable: (varetabell)

(varenr, type, pris)
VALUES
(1, '6inch', 29),
(1, '6inch meny', 51),
(1, 'footlong', 45),
(1, 'footlong meny', 66),
(1, 'salat', 39),
(1, 'salat meny', 51),
(2, '6inch', 49),
(2, '6inch meny', 69),
(2, 'footlong', 75),
(2, 'footlong meny', 96),
(2, 'salat', 49),
(2, 'salat meny', 69),


Product table: (pristabell)
---
(varenr, varenavn, innhold)
VALUES
('1','Veggie Delite','Grønnsaker og ost'),
('2','Subway Club', 'Kalkun, skinke og roasbeef'),
('3','Classic Italian BMT', 'Skinke, salami og pepperoni'),



And the query that I have tried looks like this:

SELECT  varetabell.varenavn, varetabell.varenr, varetabell.innhold,
pristabell.pris  FROM varetabell, pristabell WHERE
pristabell.varenr=varetabell.varenr AND pristabell.type='6inch' AND
pristabell.type='footlong'



- Original Message -
From: "Rick Emery" <[EMAIL PROTECTED]>
To: "'Raymond Lilleodegard'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 6:23 PM
Subject: RE: [PHP-DB] Is this possible?


> Yes, you can do that easily.
>
> It is easier to answer your question if you show us your table structure.
>
> -Original Message-
> From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 06, 2002 11:16 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Is this possible?
>
>
> Hi!
>
> I have this tricky case, at lest for me : )
>
> I'm trying to get some data out of two tables and listing the data in a
> product/price site. But. :
>
> I have one table with productinfo and one with prices.
> And it is several columns with the same id in the pricetable, because
every
> product have several sizes.
>
> So... how do I get only one row from the "product table" and two rows from
> the "price table" in one line in a page?
> Is it possible?
>
>
>
> Best regards
>
> Raymond
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Another dynamic sql.

2002-01-25 Thread Raymond Lilleødegård

My example was a litle confusing here I see.

My table have multiple price columns. something like this:

carid convertible   stationvagon   etc. etc
1100100100



- Original Message -
From: "Gurhan Ozen" <[EMAIL PROTECTED]>
To: "Raymond Lilleodegard" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, January 25, 2002 8:11 PM
Subject: RE: [PHP-DB] Another dynamic sql.


> Seems like it will NOT work because you are selecting  $car which is
already
> chosen by the user (i.e. which is a known value). I don't know how you
laid
> out your table but shouldn't your query be something like "SELECT price
from
> FROM varetabell where carid=$car"  ??
>
> Gurhan
>
> -Original Message-
> From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 25, 2002 1:48 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Another dynamic sql.
>
>
> Hi all!
>
> I have this form with some choices:
>
> 
> Enter how many cars you want:
> 
> ford
> bmw
> mercedes
> 
>
> And then I am trying to get the price out of a table in my database with
> this code:
>
>
> $sql = mysql_query("SELECT '$car' FROM varetabell where carid='$carid' ");
> $myrow= mysql_fetch_array($sql);
> $x = $myrow["$car"];
>
> $price = $x * $number;
>
>
> Shouldn't this work?  Or am I missing something here?
>
>
>
> Best regards Raymond
>
>
>
> --
> 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]