[support] Passing multiple values into a single Views argument

Neil Coghlan neil at esl-lounge.com
Sat Nov 20 14:24:07 UTC 2010


I'm close I think to passing the multiple arguments.

On a test page, this sql embedded works

<?php
global $user;
$result = db_query("SELECT node.uid FROM {node}
WHERE node.type = 'profile'");
$member = db_fetch_object($result);
return "$member->uid";
while($member = db_fetch_object($result)){
print "$member->uid";
print ",";
}
?>

I end up with "37, 31, 2"

But I need to use "return" in the argument php code

if I use

while($member = db_fetch_object($result)){
return "$member->uid";
}

at the end, still only the first one is passed, not multiple values.

anyone give me a pointer?



On 20/11/2010 10:21, Idan Arbel wrote:
> 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.
>
> don't forget to check to box in the argument settings area to accept 
> multiple arguments
>
> On Sat, Nov 20, 2010 at 3:14 PM, Neil Coghlan <neil at esl-lounge.com 
> <mailto:neil at esl-lounge.com>> wrote:
>
>     I have a view where I have selected User:uid as an argument and I am
>     using a sql query in the "Provide Default Argument" part. The problem
>     is, usually, the sql query is passing muliple UIDs back. How would I
>     pass all of them into the argument to be used by the view.
>
>     At the moment, the view is only taking the first one.
>
>     so, here is a simplified version of my php code:
>
>     global $user;
>     $result = db_query("SELECT node.uid FROM {node}
>     WHERE node.type = 'profile'");
>     $member = db_fetch_object($result);
>     return "$member->uid";
>
>     on my current db, this returns 3 UIDs...the view only takes the
>     first one.
>
>     Thanks
>
>     Neil
>
>
>     --
>     [ Drupal support list | http://lists.drupal.org/ ]
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20101120/3fba5191/attachment-0001.html 


More information about the support mailing list