Jump to content

Recommended Posts

Posted

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?

  • Solution
Posted
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.

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
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
Posted
On 4/14/2021 at 12:43 AM, CoffeeCake said:

And then do the thing it warns you about at the bottom 🙂

Good hint, thanks for the reminder! Way too many forget about this.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...