Gossamer Forum
Home : Products : DBMan : Customization :

Adding with relational mod

Quote Reply
Adding with relational mod
I use the relational mod with db's: User and Item. When a user adds an item i want his name to appear on the top of the page.

Who can help me out!

Thanks.
Quote Reply
Re: Adding with relational mod In reply to
Which page do you want this to appear on? And from which database? Is the ID the db_key field?

Try using these codes in the sub-routine where you want the name to appear:

Code:
$in{$db_key} = $db_userid;
my ($status,@hits) = &query("view");
if ($status eq "ok") {
%rec=&array_to_hash(0,@hits);
$name = "$rec{'Contact'}";
}
else {
$name=$db_userid;
}

Change Contact with the name of your Username field.

You may have to change the following codes:

Code:
%rec=&array_to_hash

To the following if you printing from the first database, but having the name printed in the form page for the second database:

Code:
%rec2=&array_to_hash

And also change $rec to $rec2. You may also have to add the switch sub-routine codes to print from the first database into the second database add form routine.

Hope this makes sense.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Adding with relational mod In reply to
Thanks Eliot for getting me started. It's working just the way i wanted.

Thanks agian.
Quote Reply
Re: Adding with relational mod In reply to
 
Quote:
Thanks Eliot for getting me started. It's working just the way i wanted.

It would appear that additional tweaking was necessary to make this work. Would you mind providing details of what you've done so other users can benefit?

Thanks!

------------------
~ ~ ~ ~ ~
Karen