Thanks very much Jed,

I did as you suggested but theres a problem somewhere
I implode like so
$toString = implode($toArray, ",");

then perform query...
$result = mysql_query("SELECT emailAddress FROM subscribers_html WHERE
mailingGroup IN ('$toString')");

I have checked that  $toString has the values that I expect, and it does (a
list of words seperated by commas).

this returns 0 rows

If I use NOT IN instead of IN it returns all rows. Theres obviously a catch
somewhere. I have scoured my books and the web, and everything looks correct
to me? Obviuosly it isn't though. Can anyone see where i'm going wrong.


I don't like asking the list for help unless I have exhausted my own reading
supplies, but today i'm stuck
What should I be looking for on the web? I can't find specific details of
WHERE value IN on the web. Searches for such phrases seem pretty useless!

Thanks for your time

Jules

----- Original Message -----
From: "Jed Verity" <[EMAIL PROTECTED]>
To: "julian haffegee" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, September 06, 2002 3:42 AM
Subject: Re: select statements


> Hello, Jules,
>
> You can use the "value in (a,b,c)" format. If necessary, implode your
array
> and do something like this:
>
> SELECT emailAddress FROM subscribers_html WHERE mailingGroup value in
> ($toText);
>
> Check the documentation, if necessary, for usage of implode and "value
in".
>
> HTH!
> Jed
>
> On the threshold of genius, julian haffegee wrote:
>
> > Hi all,
> >
> > I have a database of names and email addresses, that I want to email.
> >
> > $result = mysql_query("SELECT emailAddress FROM subscribers_html WHERE
> > mailingGroup='$toText'");
> >
> > The select statement needs to return a row when  mailingGroup='$toText',
but
> > $toText is an array. How should I write this select to say where
> > mailingGroup is an element of the array $toText. Currently it works for
> > arrays with 1 element only.
> >
> > I could turn the array into a string, but I wondered if there was a
clever
> > MySQL way of doing it all as a select
> >
> > Thanks for your help!
> >
> > Jules
> >
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >  http://www.mysql.com/manual.php   (the manual)
> >  http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> >
> >
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to