Re: Invalid MySQL result resource
| From: | David Robley | Date: | Thu, 13 Sep 2001 04:59:17 +0000 |
| Subject: | Re: Invalid MySQL result resource | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-67127@lists.php.net to get a copy of this message | ||
On Thu, 13 Sep 2001 14:22, David Robley wrote:
> > Here's what's going on.
> > ========================================================
> >
> > $connection = mysql_connect($server, $user, $pass);
> > mysql_select_db($db);
> >
> > $query = "select * from shoppingcart where PHPSESSID = '$PHPSESSID'";
> > $result = mysql_query($query,$connection);
> > $numrows = mysql_num_rows($result);
> >
> > $count = 0;
> >
> > while ($count < $numrows){
> > $cartitem = mysql_fetch_array($result);
> > $productquery = "select * from products where productid =
> > '$cartitem[productid]'"; $productresult = mysql_query($productquery);
>
> Ah. Should that be $cartitem[$productid] ??? And perhaps better
> written as
>
> $productquery = "select * from products where productid =
> '" . $cartitem[productid] . "'";
>
Oops - didn't read that closely enough.
$productquery = "select * from products where productid =
'" . $cartitem["productid"] . "'"
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
I'd love to, but the man on TV said to stay tuned.