list records selected automatically through a radiobutton option

Hi,
the code:
Code:
 SELECT comment.id FROM comment LEFT JOIN friends ON comment.userid = friends.userid WHERE friends.friend_id = '{$my->id}'
works ok when the element userid is a user element; when the userid element is a databasejoin linked to the users table, this code doesn't work.
Could it be possible to amend this code in order to have the userid element as databasejoin linked to the users table?


Thanks,

Enzo
 
It should work, as a user element *is* a join element, it just extends the database join element class to add the functionality of always setting it to the logged on user.

You'll have to look at your database and run that query by hand in something like phpMyAdmin to figure out what's going on.

-- hugh
 
I tried it in 3 different databases to be sure, but it does not work. It was working ok in the comments table before changing the userid element from user to databasejoin element. If it could be useful, you can check it online in the comments list (actually the userid element is a databasejoin).

About the query in phpMyadmin, in SQL tab I copied and pasted the code working ok for the user element and the output was green (I think positive) and it returned zero rows. How can I proceed?


Thanks,
Enzo
 
Last edited:
I just looked at the comment list on the front end, and query it generates for getData is

Code:
SELECT [...] FROM `comments` LEFT JOIN `bbyep_users` AS `bbyep_users` ON `bbyep_users`.`id` = `comments`.`user` WHERE ( comments.id IN (SELECT comments.id FROM comments LEFT JOIN friends ON comments.user = friends.user WHERE friends.friend_id = '290' ) )

... and shows half a dozen comments for "Super User". So it looks like it's working. Can you explain what I should be seeing?

-- hugh
 
Hi,
I am resuming this thread only for a question about the databasejoin linked to the users table.
When I fill a form including the databasejoin linked to the users table, this element appears blank.
Is there a way to let appear automatically the name of the logged in user in the databasejoin linked to the users table?


Thanks,

Enzo
 
Yes. Use the default:

return JFactory::getUser()->get('id');

... and set "Eval" to Yes.

Or you can probably just use {$my->id} as the default, not eval it.

-- hugh
 
I have chosen the second solution: {$my->id} as the default, not eval.
It works ok. Thank you very much Hugh.

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

Thank you.

Members online

No members online now.
Back
Top