Seth Jones Posted April 10, 2021 Posted April 10, 2021 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 Miss_B Posted April 10, 2021 Solution Posted April 10, 2021 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. Daniel F and The Old Man 2
Seth Jones Posted April 13, 2021 Author Posted April 13, 2021 (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 April 13, 2021 by Seth Jones
CoffeeCake Posted April 13, 2021 Posted April 13, 2021 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?
Seth Jones Posted April 13, 2021 Author Posted April 13, 2021 (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? Edited April 13, 2021 by Seth Jones
CoffeeCake Posted April 13, 2021 Posted April 13, 2021 And then do the thing it warns you about at the bottom :) Daniel F 1
Daniel F Posted April 16, 2021 Posted April 16, 2021 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.
Recommended Posts