Jump to content

Community

Querying Database


Go to solution Solved by Miss_B,

Recommended Posts

How do we query a database separate in an application?

 

For example, if an application has something called profileSongs, how would we query that and retrieve a table value in php? Any examples or documentation available?

Link to comment
Share on other sites

  • Solution
10 minutes ago, Seth Jones said:

How do we query a database separate in an application?

 

For example, if an application has something called profileSongs, how would we query that and retrieve a table value in php? Any examples or documentation available?

What is it precisely that you want to do? 

Have a look at this link for quering/accessing the database.

To use tables to pull and display info from a database table, have a look at this link.

Hope it helps.

Link to comment
Share on other sites

Posted (edited)

I wanted to clarify my question.

My plugin uses the database table core_members, which is not allowed anymore. I needed to make it use a separate database table called profileSongs_song which holds the profile songs URL. I needed help with linking the database tables with the member ID. Any tips is appreciated.

    protected function _profileSongSet( \IPS\Helpers\CoverPhoto $song ) 
    {
        $this->member->kuzi_song_path = isset( $song->file ) ? (string) $song->file : NULL;
        $this->member->save();
    }

So this line is what I need to change.

$this->member->kuzi_song_path = isset( $song->file ) ? (string) $song->file : NULL;

I have a database schema created in my application called profilesongs_song, with the profile song URL which the column name is songPath.

Edited by Seth Jones
Link to comment
Share on other sites

Posted (edited)
48 minutes ago, CoffeeCake said:

You would create a table for your application and include the memberID as one of the columns.

Do you need to join the core_members table for any reason?

No, I just need to store the memberID in the table, correct?

 

image.thumb.png.aa81cb8aa770053b4e3f0fd6d625b9af.png

Edited by Seth Jones
Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy