Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Translating data from another table

Quote Reply
Translating data from another table
Hi guys

I've created a database with two tables; one called "SfP_Music" and the other "SfP_Composers", the tables are connected in a many to one relationship. The "music" table has a column in it called "composer_id" which is a foreign key from the Composers table and allows me to link a piece of music and its composer together.

My problem scenario is as follows. A user adds a piece of music to the database and selects from a drop down list the relevant composer (generated via a global from the composers table).
What I want to do is display the "human" readable name for the composer (stored in the column "Name" in the composers table) rather than the 'Composer_id' that is currently returned on the add_success page.

I have attempted doing this through a global with the following code, but it doesn't seem to work.

sub {
my $tags = shift;
my $table = $DB->table('SfP_Composers');
my $sth = $table->get('Composer_ID', 'HASH', ['Name']);
my $output .= $sth;
}

I hope someone can point me in the right direction!

Cheers,

Hannah
Subject Author Views Date
Thread Translating data from another table hannahmackenzie 7756 Mar 14, 2002, 9:29 AM
Thread Re: [hannahmackenzie] Translating data from another table
Paul 7555 Mar 14, 2002, 9:47 AM
Thread Re: [Paul] Translating data from another table
hannahmackenzie 7580 Mar 14, 2002, 9:57 AM
Post Re: [hannahmackenzie] Translating data from another table
Paul 7546 Mar 14, 2002, 10:02 AM
Thread Re: [Paul] Translating data from another table
hannahmackenzie 7569 Mar 14, 2002, 10:00 AM
Thread Re: [hannahmackenzie] Translating data from another table
Paul 7542 Mar 14, 2002, 10:04 AM
Post Re: [Paul] Translating data from another table
hannahmackenzie 7519 Mar 14, 2002, 10:19 AM
Thread Re: [hannahmackenzie] Translating data from another table
604 7541 Mar 14, 2002, 10:04 AM
Thread Re: [TheStone] Translating data from another table
Paul 7559 Mar 14, 2002, 10:07 AM
Thread Re: [Paul] Translating data from another table
604 7544 Mar 14, 2002, 10:08 AM
Post Re: [TheStone] Translating data from another table
Paul 7545 Mar 14, 2002, 10:18 AM
Thread Re: [TheStone] Translating data from another table
hannahmackenzie 7545 Mar 14, 2002, 10:20 AM
Thread Re: [hannahmackenzie] Translating data from another table
Paul 7523 Mar 14, 2002, 10:21 AM
Post Re: [Paul] Translating data from another table
hannahmackenzie 7516 Mar 15, 2002, 8:03 AM