Re: Help with a query
| From: | Ignatius Reilly | Date: | Fri, 07 Mar 2003 08:23:14 +0000 |
| Subject: | Re: Help with a query | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26167@lists.php.net to get a copy of this message | ||
Still not good. Try:
"SELECT a.item_id, a.subtotal, a.quantity
FROM shopping_cart a, orders b
WHERE b.session_id = ".session_id()."
AND b.customer_id = $customer_id
AND a.order_id = b.border_id"
session_id() must be interpolated.
Ignatius
----- Original Message -----
From: "Corne' Cornelius" <cornec@reach.co.za>
To: <php-db@lists.php.net>
Sent: Friday, March 07, 2003 9:00 AM
Subject: Re: [PHP-DB] Help with a query
> Why not use:
>
> SELECT a.item_id, a.subtotal, a.quantity
> FROM shopping_cart a, orders b
> WHERE b.session_id = session_id()
> AND b.customer_id = $customer_id
> AND a.order_id = b.border_id
>
> ?
>
> !Exclude Disclaimer!
>
> Jonathan Villa wrote:
>
> >I can't figure this query out.
> >
> >I want to pull data from 2 tables but using a primary key from one.
> >
> >Here is what I think it should look like.
> >
> >SELECT item_id, subtotal, quantity from shopping_cart WHERE order_id =
> >(SELECT order_id FROM orders WHERE session_id = session_id()) AND
> >customer_id = $customer_id;
> >
> >-Jonathan
> >
> >
> >
> >
> >
> >
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>