Are you looking to do a WHERE ... IN ...? (I presume that id is not an array - or is it)?
If so, then yes, it is quite possible. Have a read through the documentation available here which discusses how to perform complex where operations in Editor.
Yes and No, i didn't ask that question properly.
What I wanted to do was to insert a variable in the condition after an IF statement, where my users_id is passed via the url. is there an easier way to do this?
<?php
$powerusers=$row['id'];
$allids="SELECT users_id2 FROM Table";
if($users_id==$powerusers){$usersA=$allids;}
else
{$usersA="SELECT users_id2 FROM Table WHERE users_id2=$users_id";}
<?php
>
?>
->where( function ( $q ) {
global $usersA;
$q->where( 'Table.users_id2', '('.$usersA.')', 'IN', false );
} )
Answers
Are you looking to do a
WHERE ... IN ...
? (I presume thatid
is not an array - or is it)?If so, then yes, it is quite possible. Have a read through the documentation available here which discusses how to perform complex where operations in Editor.
Allan
Yes and No, i didn't ask that question properly.
What I wanted to do was to insert a variable in the condition after an IF statement, where my users_id is passed via the url. is there an easier way to do this?
The only change I would suggest using the
use
statement rather thanglobal
(function ($q) use ($usersA) {
. I don't see any other option at the moment.Allan