Re: problems with looping array
| From: | Jordan | Date: | Mon, 03 Dec 2001 09:30:44 +0000 |
| Subject: | Re: problems with looping array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76369@lists.php.net to get a copy of this message | ||
I tried but nothing different happened. I'm still playing though and I'll
see if I can make it work. I'm new to all of this...so we'll see how it
goes. Thanks for your help.
-jordan
Fred <fred.nospam.please@querymagic.com> wrote in message
news:20011203090233.1958.qmail@pb1.pair.com...
> Strings in your sql query must be quoted. Try this instead:
>
> > $result = mysql_query("SELECT * FROM ar
> > LEFT JOIN company on ar.company_id=company.company_id
> > LEFT JOIN scale on ar.scale_id=scale.scale_id
> > WHERE item_number = \"$item[$index]\")";
>
> Fred
>
> Jordan <newimagedesign@newimagedesign.com> wrote in message
> news:20011203081812.81073.qmail@pb1.pair.com...
> > here's the situation. I'm making a shopping cart, when an item is added
> > it's item number is added into an array. I then want this array's items
> to
> > be compared agains the database. Unfortunately I haven't been able to
use
> a
> > variable in the query string of MySQL. something along the lines of....
> >
> >
> > <?PHP
> >
> > include ('connect.php');
> >
> > $result = mysql_query("SELECT * FROM ar
> > LEFT JOIN company on ar.company_id=company.company_id
> > LEFT JOIN scale on ar.scale_id=scale.scale_id
> > WHERE item_number =" . $item[$index]);
> >
> > ?>
> >
> > where $item is the array of item numbers and $index is an auto
> incrementing
> > number that increments at the end of the loop. Please help if you know
of
> > anyway to use this variable. Also, I can post my whole script if
> needed...I
> > just didn't want unneeded info posted. Thanks in advance.
> >
> > -Jordan
> >
> >
>
>