klox7 VIP
Total posts: 914
02 Jul 2014 19:29

I'm trying to add query fo field (autocomplete list) to connect to external database of phpBB forum to get usernames from specific group. This is my query:

SELECT 'username'
FROM 'bbforum_users'
WHERE 'group_id' = '6'

I connected to external database with proper credentials. Is there anything else I must do?

At the same time I would like to link those values (users) to their phpbb profile. URL looks like this http://www.yoursite.com/memberlist.php?mode=viewprofile& ;u=user

Last Modified: 08 Jul 2014


Sergey
Total posts: 13,748
02 Jul 2014 23:30

klox7 At the same time I would like to link those values (users) to their phpbb profile. URL looks like this http://www.yoursite.com/memberlist.php?mode=viewprofile& ;u=user

Better give real URL. Because now I have a question u is user ID or user login name?

I think query have to be something like

SELECT `userid` AS id, `username` AS text
  FROM `bbforum_users`
 WHERE `group_id` = '6'

klox7 VIP
Total posts: 914
03 Jul 2014 08:26

Sergey Better give real URL. Because now I have a question u is user ID or user login name?

u is user ID. But how will link be created with right user id?

And do you maybe know how to get usernames from Joomla database. I can't find group id in users table.


Sergey
Total posts: 13,748
03 Jul 2014 11:42

Иге that is not from Joomla DB right? You query different DB so there is no connection of user here and there.

TO create a link you have to insert into URL processing parameter

 http://www.yoursite.com/memberlist.php?mode=viewprofile& ;u=[ID]

Where [ID] is what is selected in userid AS id. But I do not know the column name. Maybe it is not userid.


klox7 VIP
Total posts: 914
07 Jul 2014 06:14

To sum up for phpBB:

Sergey SELECT user_id AS id, username AS text
FROM USERS_TABLE
WHERE group_id = '6'

and this as link

Sergey http://www.yoursite.com/memberlist.php?mode=viewprofile&u=[ID]


Sergey
Total posts: 13,748
07 Jul 2014 23:59

Yes. But I do not know what is the field name in DB table that is used in URL as value of u parameter. Change userid to that name.


pepperstreet VIP
Total posts: 3,837
08 Jul 2014 01:22

Sergey field name in DB table

Seems to be user_id as far as this wiki info is still valid (phpBB v3)


Sergey
Total posts: 13,748
08 Jul 2014 02:02

It might be username too. Depending on what is used in URL as u parameter.


klox7 VIP
Total posts: 914
08 Jul 2014 08:23

Sergey But I do not know what is the field name in DB table that is used in URL as value of u parameter.

Isn't this for selecting data from multiple tables: Click here to link...

And FYI upper query works fine only if group_id is default group for user. Otherwise I think you have to use solution from link I provided. I'm still figuring it out...

Powered by Cobalt