Unknown column 'Array' in 'where clause'

brian

Member
Hello,
First of all, Github update did not correct the error... Email component works fine else where when selecting single users

I have a form with a left join & inner join. There is a repeat group which links to the users. I want to send emails to the users selected in the repeat group on submission of the form.
When i try to use the email form plugin, with the following code to get the email to address ;

"
$myUserid = $formModel->getElementData('task_list_3_repeat___user', true);
$myUserid = is_array($myUserid) ? $myUserid[0] : $myUserid;
return JFactory::getUser($myUserid)->get('email');
"
When i submit the record it stores, but will not email and returns the following error;

"Unknown column 'Array' in 'where clause' SQL=SELECT `id` FROM `#__users` WHERE `username` = Array LIMIT 1"

I have tried several things, checked the configuration and ensured the joins do not conflict but i cannot understand how to correct this error. I have tested it on another form and it works perfectly fine, the only difference is the other form only has one join, the left join which exists in the other table also with another join.

Can someone please help me? This has been bothering me for too long!!!
 
Last edited:
First of all, Github update did not work.

Can you be more specific? What "doesn't work" in the github update?

Add ...

var_dump($myUserid);exit;

... as the second line (before the is_array test), and paste the output here.

-- hugh
 
Hello Hugh,
Thanks for your assistance, and just to clarify by github did not work i mean updating the component with github did not correct my error* Sorry about that.

When i add var_dump I get ;

array(1) { [0]=> array(1) { [0]=> string(3) "235" } }

235 is the ID of the user in the repeated group

if i select two users - 1 and 2 i get respectively.
array(2) { [0]=> array(1) { [0]=> string(3) "236" } [1]=> array(1) { [0]=> string(3) "235" } }

However if i remove var_dump i get

Error
Unknown column 'Array' in 'where clause' SQL=SELECT `id` FROM `#__users` WHERE `username` = Array LIMIT 1

If you could assist i would very much appreciate it!!
Thanks again!
 
Ah, I didn't notice in the original message that you are using an element from a repeat group. And yes, elements in repeat groups are themselves array, with as many entries as there are repeats of the group.

So do you need to extract all the selected emails?

Sent from my HTC6545LVW using Tapatalk
 
Yes, i am using the email plugin and cannot for the life of me derive the user emails. It works fine when submitting an alternative form when there is no repeat group involved.
 
Friendly bump,
Can someone assist me in extracting the emails from the selected users?
I'm still stuck on this and it would be a vital part of the application i am building to update the selected users on submission.
 
That's why we offer paid subscriptions, so you can get more timely assistance writing you vital custom code. :)

Code:
$myEmails = array();
$myUserids = $formModel->getElementData('task_list_3_repeat___user', true);
foreach ($myUserids as $myUserid) {
   $myUserid = is_array($myUserid) ? $myUserid[0] : $myUserid;
   $myEmails[] = JFactory::getUser($myUserid)->get('email');
}
return implode(',', $myEmails);

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top