Select Field of Fans/Groups

Hey Folks. I have a small dillemma (hopefully, but I can't figure it out). I have a module which is a duplicate of the groups module. Within this module, I am adding some functionality from another module that I created (which is also a duplicate of the Groups module). Let me lay everything out and then ask my question.

The first module is a Practice (Doctor's Business) Module. It allows a member to add his/her Practice and it is listed in a directory. No different than adding a new Group. The second module is a Clients module (list of all patients for a specific member). I was tasked with a quest to figure out a way to make the functionality of the two better  - according to specific requests. Also - I have the Sub-Profiles module as well.

What I want to do is this: when a member adds a new client, I want them to have the ability of adding that client to a Practice (Business) that they are a fan of. It is possible for a member to work at more than one Practice and have different Clients in each Practice, So, when the member adds the new client, II want to add a select box in which they can select which Practice this Client should be added to.

I figured the best way would be to pull up all Practices that the member is a Fan of and display them in the select dropdown box. The only issue is that the fans table does not list the name of the Practice (Group) , just the id number of that group.

 

If I use this:

 

$aPractices = $GLOBALS['MySQL']->getPairs("SELECT `id_entry` , `confirmed` FROM `cf_practices_fans` WHERE `id_profile` = '" . $_COOKIE['memberID'] . "'", 'id_entry', 'id_entry');

 

then it will display the Practice(Group) id numbers, but I need to display the name of the Practice so the member knows which Practice it is. It is perfectly fine if only the id number is entered into the database.

Anyone know how I can resolve this? Any assistance would be greatly appreciated. Thanks in advance.

caredesign.net
Quote · 3 Aug 2014

Holy Smnokes - I think I got it figured out (I hate dealing with joining tables). My sql statement is as follows now, and it seems to be displaying what I want properly. Here is my solution:

$aPractices = $GLOBALS['MySQL']->getPairs("SELECT cf_practices_fans.id_entry , cf_practices_main.title FROM cf_practices_fans, cf_practices_main WHERE cf_practices_fans.id_entry = cf_practices_main.id AND cf_practices_fans.id_profile = '" . $_COOKIE['memberID'] . "'", 'id_entry', 'title');

caredesign.net
Quote · 3 Aug 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.