Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Help:
Connect multiple module tables with where condition (jr5)
starter



Joined: 21 Aug 2013
Posts: 32

Posted: 10/04/13 21:32 
i need to connect jrUser(item,item_key), jrProfile(item,item_key) tables with where condition.

Eg: where: user_language='en-US' and profile_quota_id=1

Which is the easiest way to do this.

Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 10/04/13 22:22 
This looks like the easiest way to me:

Code
  $_sp = array(
        'search'        => array(
            "user_language = en-US",
            "profile_quota_id = 1"
        )
    );
    $_rt = jrCore_db_search_items('jrProfile', $_sp);


See if it returns the results your looking for. to print to the screen, i like:

Code
#############Debugging#############
    //todo remove this debuggin text
    print '<div style="text-align:left"><pre>';
    print_r($_rt);
    print '</pre></div>';
    #############Debugging#############



and if you need that wrapped in a function, in your modules index.php file:

Code

function view_xxYourModule_something($_post, $_user, $_conf)
{
    echo 'hello world.';

    // Make sure they have not submitted before
    $_sp = array(
        'search'        => array(
            "user_language = en-US",
            "profile_quota_id = 1"
        )
    );
    $_rt = jrCore_db_search_items('jrProfile', $_sp);
    #############Debugging#############
    //todo remove this debuggin text
    print '<div style="text-align:left"><pre>';
    print_r($_rt);
    print '</pre></div>';
    #############Debugging#############
}



access it from:
yoursite.com/yourmodule/something


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
starter



Joined: 21 Aug 2013
Posts: 32

Posted: 10/04/13 23:02 
yea it works!

One more quest.

If i need to connect with other module like jrAudio, jrComment etc , will it work?

or shall i add the module names in argument list like this jrCore_db_search_items('jrProfile,jrAudio, jrComment', $_sp);

Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 10/04/13 23:08 

starter:
If i need to connect with other module like jrAudio, jrComment etc , will it work?

or shall i add the module names in argument list like this jrCore_db_search_items('jrProfile,jrAudio, jrComment', $_sp);


Best way to find out if it will work is if you try-and-see, i dont know off the top of my head.

dont add all the module names with commas, i dont think that will work. I've never seen anything like that in the code anywhere.

Try putting the name of the module of the things you want returned in there.

so if you want a list of profiles:
jrCore_db_search_items('jrProfile', $_sp);

if you want a list of audio files:
jrCore_db_search_items('jrAudio', $_sp);

if you want a list of images:
jrCore_db_search_items('jrImage', $_sp);

Your asking "get me a list of items where......." so I think the module is the type of items your after.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Help

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.