Gossamer Forum
Home : Products : DBMan : Customization :

Another relational db mod question

Quote Reply
Another relational db mod question
I am trying to understand the relational db mod so that, once I "get" it, I can set it up to suit my needs. I have tried to follow JPDeni's relational mod notes (http://www.jpdeni.com/.../Mods/relational.txt) and have set up a db closely resembling her description.

For the moment, the following snippet of code is puzzling me:
Code:
# Print out the link to the full item record
# Note that I am using $db_script_url and *not* $db_script_link_url.
print qq|
<tr><td>
<a href="$db_script_url?db=item&uid=$db_uid&id=$rec2{'id'}&view_records=1">$rec2{'Item'}</a>
</td></tr>
|;
}
(note: in the above, 'id' is deliberately changed from 'ItemID' as is described in JPDeni's notes; my field name is 'id')

According to her notes, this is suppose to "list the names of the items the user has added to the database, with a link to the full display of the description of the item." While it does indeed list the names of the items, it does so for *all* the items in the item db, not just those added by this user. I would like some guidance what I may have done wrong.

More questions to come. Wink Thanks!

-Andy

ps. Is there a working demo of the relational db mod described in JPDeni's notes? I'd love to actually see how it's suppose to work when complete, not just envision what it's suppose to do.

Quote Reply
Re: Another relational db mod question In reply to
My bookstore database uses the relational mod to connect the book records with the reviews records. I think there's only one that has more than one review, but you can see it at http://www.jpdeni.com/...=1&Title=Dummies.

You didn't list the entire code for doing the search. Do you have

Code:

&switch_to_item;
undef %in;
$in{'UserID'} = $rec{'UserID'};
$in{'sb'} = 6;
$in{'so'} = 'descend';
$in{'mh'} = 100;

my ($status2,@hits2) = &query("view");

if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print qq|<table>|;

for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=item&uid=$db_uid&ItemID=$rec2{'ItemID'}&view_records=1">$rec2{'Item'}</a>
</td></tr>
|;
}
print qq|</table>|;
}
I'll see if I can set up a database to illustrate the mod. The biggest reason I haven't is that it takes a lot of time just to fill in the records.


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Another relational db mod question In reply to
Sorry for not posting the full code (didn't think it would be needed Blush.)

I've copied all my files to a location that they may be looked over, and I will provide a url that you can see what I am talking about:

http://hwhoa.org/dbman/ DBMan files
http://hwhoa.org/...ssads/db.cgi?db=user Sample db
Quote Reply
Re: Another relational db mod question In reply to
I didn't see a problem with your file. I'm not sure what's going on.

Also, I didn't get the demo written last night. (I was finally finishing on the multiple file upload.) Maybe tonight. I will also have links to text versions of the files I use so that you can use them if you wish.

JPD
http://www.jpdeni.com/dbman/