<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    this is where I'm up to<br>
    <br>
    <tt>$result = db_query("SELECT node.nid, node.title, node.type,
      node.uid FROM node WHERE node.uid IN (SELECT node.uid FROM node<br>
      WHERE nid IN (SELECT nid FROM content_type_profile<br>
      WHERE field_city_value IN (SELECT field_city_value FROM
      content_type_profile<br>
      JOIN node ON content_type_profile.nid = node.nid<br>
      WHERE node.uid = 2 AND node.type = 'profile')))<br>
      AND node.uid != 2");<br>
      $member = db_fetch_object($result);<br>
      while($member = db_fetch_object($result)){<br>
      return $member-&gt;uid . "+";<br>
      }</tt><br>
    <br>
    I expect it to come back "31+37+39+" but it's coming back only "37+"
    (if I test in on a page and use "print" instead of "return", I get
    exactly what I want)<br>
    <br>
    that would be my woeful php obviously for which I apologise now.<br>
    <br>
    I'm trying to adapt what Idan wrote but cannot get it to output
    multiple UIDs to insert as the user:uid argument.<br>
    <br>
    I'm also getting Query Build Time in views of around 5050ms so I'm
    guessing my sql is massively inefficient too...I do need the join
    and the nested SELECTs though. I'm getting the UID of all the people
    who share the location taxonomy term on their profile with the
    logged in user, so it was never going to be easy!<br>
    <br>
    by the way, in my query, I'm hardcoding the logged in user's UID (2)
    just for testing purposes.<br>
    <br>
    Neil<br>
    <br>
    On 20/11/2010 12:23, Idan Arbel wrote:
    <blockquote
      cite="mid:03da01cb88c6$e6b4ecb0$b41ec610$@arbel-designs.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 14 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><a moz-do-not-send="true"
            name="_MailEndCompose"><span class="apple-style-span"><span
                style="font-size: 9pt;">You can see that I cycle through
                the id's and add them to $args[0] and return it. Similar
                to what you did, try changing the variable name to
                $args[0].<o:p></o:p></span></span></a></p>
        <p class="MsoNormal"><span class="apple-style-span"><span
              style="font-size: 9pt;">for($i=1; $i&lt;count($terms);
              $i++)</span></span><span style="font-size: 9pt;"><br>
            <span class="apple-style-span">$args[0] = $args[0] ."+"
              .$terms[$i]; // replace the + with , if you want and "And"
              action instead of "or"</span><br>
            <span class="apple-style-span">}</span><br>
            <br>
          </span><span style="font-size: 11pt; font-family:
            &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31,
            73, 125);"><o:p></o:p></span></p>
        <div>
          <div style="border-right: medium none; border-width: 1pt
            medium medium; border-style: solid none none; border-color:
            rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color;
            padding: 3pt 0cm 0cm;">
            <p class="MsoNormal"><b><span style="font-size: 10pt;
                  font-family:
                  &quot;Tahoma&quot;,&quot;sans-serif&quot;; color:
                  windowtext;">From:</span></b><span style="font-size:
                10pt; font-family:
                &quot;Tahoma&quot;,&quot;sans-serif&quot;; color:
                windowtext;"> <a class="moz-txt-link-abbreviated" href="mailto:support-bounces@drupal.org">support-bounces@drupal.org</a>
                [<a class="moz-txt-link-freetext" href="mailto:support-bounces@drupal.org">mailto:support-bounces@drupal.org</a>] <b>On Behalf Of </b>Neil
                Coghlan<br>
                <b>Sent:</b> Saturday, November 20, 2010 5:20 PM<br>
                <b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:support@drupal.org">support@drupal.org</a><br>
                <b>Subject:</b> Re: [support] Passing multiple values
                into a single Views argument<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
        <p class="MsoNormal">hmm, can't see how that would apply in my
          case. Maybe it does, but can't see it.<br>
          <br>
          bottom line: if an sql query returns 3 values, how do I get
          those 3 values into a Views argument via "provide default
          argument"?<br>
          <br>
          On 20/11/2010 10:30, Idan Arbel wrote: <o:p></o:p></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            &quot;Calibri&quot;,&quot;sans-serif&quot;;">Take a look at
            this code I used for something similar:</span><o:p></o:p></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            &quot;Calibri&quot;,&quot;sans-serif&quot;;">&nbsp;</span><o:p></o:p></p>
        <p class="MsoNormal"><span class="apple-style-span"><span
              style="font-size: 9pt;">if (arg(0) == 'node' &amp;&amp;
              is_numeric(arg(1))) {</span></span><span style="font-size:
            9pt;"><br>
            <span class="apple-style-span">$node=node_load(arg(1));</span><br>
            <span class="apple-style-span">$term =
              taxonomy_node_get_terms_by_vocabulary($node, 4); // 4
              being the vocabulary id</span><br>
            <span class="apple-style-span">$terms = array_keys($term);</span><br>
            <span class="apple-style-span">$args[0] = $terms[0];</span><br>
            <span class="apple-style-span">for($i=1;
              $i&lt;count($terms); $i++)</span><br>
            <span class="apple-style-span">$args[0] = $args[0] ."+"
              .$terms[$i]; // replace the + with , if you want and "And"
              action instead of "or"</span><br>
            <span class="apple-style-span">}</span><br>
            <span class="apple-style-span">return $args[0];</span></span><o:p></o:p></p>
        <p class="MsoNormal"><span class="apple-style-span"><span
              style="font-size: 9pt;">&nbsp;</span></span><o:p></o:p></p>
        <p class="MsoNormal"><span class="apple-style-span"><span
              style="font-size: 9pt;">might help you out.</span></span><o:p></o:p></p>
        <p class="MsoNormal"><span class="apple-style-span"><span
              style="font-size: 9pt;"><br>
              Idan</span></span><o:p></o:p></p>
        <p class="MsoNormal"><span style="font-size: 11pt; font-family:
            &quot;Calibri&quot;,&quot;sans-serif&quot;; color: rgb(31,
            73, 125);">&nbsp;</span><o:p></o:p></p>
        <div>
          <div style="border-right: medium none; border-width: 1pt
            medium medium; border-style: solid none none; padding: 3pt
            0cm 0cm; border-color: -moz-use-text-color;">
            <p class="MsoNormal"><b><span style="font-size: 10pt;
                  font-family:
                  &quot;Tahoma&quot;,&quot;sans-serif&quot;; color:
                  windowtext;">From:</span></b><span style="font-size:
                10pt; font-family:
                &quot;Tahoma&quot;,&quot;sans-serif&quot;; color:
                windowtext;"> <a moz-do-not-send="true"
                  href="mailto:support-bounces@drupal.org">support-bounces@drupal.org</a>
                [<a moz-do-not-send="true"
                  href="mailto:support-bounces@drupal.org">mailto:support-bounces@drupal.org</a>]
                <b>On Behalf Of </b>Neil Coghlan<br>
                <b>Sent:</b> Saturday, November 20, 2010 3:25 PM<br>
                <b>To:</b> <a moz-do-not-send="true"
                  href="mailto:support@drupal.org">support@drupal.org</a><br>
                <b>Subject:</b> Re: [support] Passing multiple values
                into a single Views argument</span><o:p></o:p></p>
          </div>
        </div>
        <p class="MsoNormal">&nbsp;<o:p></o:p></p>
        <p class="MsoNormal">Idan, I only just realised myself there was
          an "accept multiple arguments" checkbox....without that, I
          never would get it working!<br>
          <br>
          so...now with that checked, I still need to get the UID's
          passed in x,y,z or x+y+z format.<br>
          <br>
          On 20/11/2010 10:21, Idan Arbel wrote: <o:p></o:p></p>
        <div>
          <p class="MsoNormal">if you want to view to take them into
            account as using "AND" then return them like so: 12+32+34,
            if you want it to take them into account as or return them
            as so 12,32,34. <o:p></o:p></p>
          <div>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          </div>
          <div>
            <p class="MsoNormal" style="margin-bottom: 12pt;">don't
              forget to check to box in the argument settings area to
              accept multiple arguments<o:p></o:p></p>
            <div>
              <p class="MsoNormal">On Sat, Nov 20, 2010 at 3:14 PM, Neil
                Coghlan &lt;<a moz-do-not-send="true"
                  href="mailto:neil@esl-lounge.com">neil@esl-lounge.com</a>&gt;
                wrote:<o:p></o:p></p>
              <p class="MsoNormal">I have a view where I have selected
                User:uid as an argument and I am<br>
                using a sql query in the "Provide Default Argument"
                part. The problem<br>
                is, usually, the sql query is passing muliple UIDs back.
                How would I<br>
                pass all of them into the argument to be used by the
                view.<br>
                <br>
                At the moment, the view is only taking the first one.<br>
                <br>
                so, here is a simplified version of my php code:<br>
                <br>
                global $user;<br>
                $result = db_query("SELECT node.uid FROM {node}<br>
                WHERE node.type = 'profile'");<br>
                $member = db_fetch_object($result);<br>
                return "$member-&gt;uid";<br>
                <br>
                on my current db, this returns 3 UIDs...the view only
                takes the first one.<br>
                <br>
                Thanks<br>
                <br>
                Neil<br>
                <span style="color: rgb(136, 136, 136);"><br>
                  <br>
                  --<br>
                  [ Drupal support list | <a moz-do-not-send="true"
                    href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a>
                  ]</span><o:p></o:p></p>
            </div>
            <p class="MsoNormal">&nbsp;<o:p></o:p></p>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>