on 3/31/03 10:41 AM, Jonathan Villa at [EMAIL PROTECTED] appended the
following bits to my mbox:

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

A few questions:

1) Are you sure your RDBMS supports sub-queries?  Most do, but MySQL does
not.

2) Have you tried echoing the query to see exactly what is being passed to
the RDBMS?  That is, perhaps session_id() or $customer_id is not giving a
valid value.

3) Using the results of (2) above, have you input the query into another
RDBMS client (i.e., command line version) to see what kind of errors are
given.

HTH.

Sincerely,

Paul Burney
<http://paulburney.com/>

<?php
    while ($self != "asleep") {
        $sheep_count++;
    }
?>



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

Reply via email to