Gossamer Forum
Home : Products : DBMan : Customization :

Mod for different search results???

Quote Reply
Mod for different search results???
Hey there. I have a db that has a lot of info in the table. I'd like people to be able to search the db by selecting the criteria, and the results would be displayed by a site name, a short description, and a link to a view of that record with all the fields displayed. I know how to edit the hmtl.pl file for a display, but the deal is that you'd need two seperate querry() functions - one to run the search that calls one method of displaying the short description, and another one that can be linked fron the short results to display the full results for that record ID. Any ideas?

Thanks!
Quote Reply
Re: Mod for different search results??? In reply to
Try looking at the modification I wrote. It's available at
http://www.drizzle.com/~hall/dbmod/short.txt



------------------
JPD





Quote Reply
Re: Mod for different search results??? In reply to
And that oughta do it huh? I looked at the code and can see what you're doing, so I'll implement it. Excellent - Thanks for the help!
Quote Reply
Re: Mod for different search results??? In reply to
Ok, I edited the file and I can get the short deisplay, but using the anchor tag you gave me and any variants thereof result in an unknown action error. When I use this:
<a href="$db_script_link_url?view_records=1&$db_key=$rec{$db_key}">

I get the logon error screen. Any ideas what the problem is? Thanks for your help so far!

Oh, if you wanna see it in action, just head to www.nebulus.org/dbman



------------------
Quote Reply
Re: Mod for different search results??? In reply to
There was an error in the text file. It should be

<a href="$db_script_link_url&ww=on&$db_key=$rec{$db_key}&$view_records=1">$rec{'field name'}</a>

You can't put the ? in there, since it's already within the $db_script_link_url variable.


------------------
JPD







[This message has been edited by JPDeni (edited March 13, 1999).]
Quote Reply
Re: Mod for different search results??? In reply to
Thanks! I actually used this:
<a href="$db_script_link_url&view_records=1&$db_key=$rec{$db_key}"> and it worked. It didn't seem to know what ww=on was. What is it?

Thanks again for the help - the database is coming along nicely now!
Quote Reply
Re: Mod for different search results??? In reply to
Somebody else had trouble with the ww=on thing. That was very odd.

The ww=on switch means to look for "whole words" only. Depending on what your $db_key is, it might not cause a problem to not have it. Then again, it might.

For example, if you have a key that is consecutive numbers starting from 1 and you do a search for ID=1, you'll not only get the one with ID=1, but also ID=10, ID=11, ID=12, etc, and ID=21, ID=31, and on and on. The only way I can see around this, if for some reason ww=on doesn't work, is to start with a 5-digit number in your .count file (or even a larger one). If you have 5 digits -- running from 10000 to 99999, you'll be able to enter 90,000 records before you run into a problem. A six digit number will let you enter 900,000 records before there's a duplication.

OTOH, if you are certain that the key for one record will not be part of the key for another record (like if you have a social security number or something for your key), then you'll be just fine.


------------------
JPD





Quote Reply
Re: Mod for different search results??? In reply to
ahhh, ok. Well, I left the key defined as the ID, so it wasn't needed. Here's another question for you though. Can you use DBman databases with Links?

I was thinking about switching over now that I've looked at Links some more and I'd hate to have to repopulate the tables.
Quote Reply
Re: Mod for different search results??? In reply to
You could probably use Links for your site, but I'm not sure if you'd be able to do the kind of searches you can do now. Links does just a keyword search.

As for being able to use the DBMan .db file, yes and no. It's quite a bit more work to add fields in Links (you can do it, but it's more work Smile ), so you'd probably have to edit your DBMan file a bit to conform more closely to the structure of Links.

You might get more info in the Links forum.

------------------
JPD





Quote Reply
Re: Mod for different search results??? In reply to
Ok guys, this is something I would like to do as well. I've gone through the steps and seem to be doing something wrong as I still get the complete record listed instead of my shorter version with a link.

Here's my html.pl file to view. (I have defined pretty long $global_header and $global_footer sections - just scroll past them please)

http://www.dropzone.com/html_pl.txt

Any advice would be appreciated!



------------------
Safe swoops
Sangiro

www.dropzone.com
Quote Reply
Re: Mod for different search results??? In reply to
I'd suggest going here:
http://www.drizzle.com/~hall/dbmod/short.txt
and save that file, then keep it open as you edit your html.pl file. I followed the instructions exactly, and the only problem I had was the link to the whole record which JPDeni put in there. It works very well. Here's the link to my database, and if you want the snippet of code for it, email me.
http://www.nebulus.org/dbman . The database that uses the short listing is the designer's index.
Enjoy!
Quote Reply
Re: Mod for different search results??? In reply to
Nebulus,

I've done all you suggested. Looked at the txt file and surfed your database. It still doesn't work.

Could you be so kind as to show me your html.pl file? I'd like to compare and see where I'm loosing the track.



------------------
Safe swoops
Sangiro

www.dropzone.com
Quote Reply
Re: Mod for different search results??? In reply to
You say the short view doesn't print out and no matter how many records are returned, you get the long view? (Anyway, that's the way I understood your problem to be.)

Just for debugging purposes, try commenting out the lines that refer to html_record -- so the lines in html_view_succes would look like:

Code:
# if ( $db_total_hits == 1 ) {
# &html_record(&array_to_hash($_, @hits));
# return;
# }

See what happens then.

Another possible problem I see (but it wouldn't result in the problem you're having) is too many table tags in your html_record_short display.

You have

Code:
print "<CENTER><TABLE>";
for (0 .. $numhits - 1) {
&html_record_short (&array_to_hash($_, @hits));
}
print "</TABLE></CENTER>";

and then your html_record_short is

Code:
print qq|
<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0 BGCOLOR="#FFFFCC">
<TR><TD>
...
</TD>
</TR>
</TABLE>
|;

You should either take out the table tags in html_view_success, or at least add <TR><TD> tags after the <TABLE> tag and </TD></TR> tags before the </TABLE> tag. Or you could take out the <TABLE> and </TABLE> tags in html_record_short.

At this point, the tags in html_view_success aren't doing any good and could be causing problems.

Is there any way I could directly access your database so I could see it myself? If you don't want to post it here, you can send it to me privately at hall@drizzle.com .




------------------
JPD





Quote Reply
Re: Mod for different search results??? In reply to
The "List All" worked for me, except when I clicked on an employee name, I got an "invalid/expired user session." That wouldn't be caused by anything in the "short" mod. You have other troubles with that. (Just a little update. I tried it again and had no trouble at all with "invalid/expired user session.")

When you say "procedding records do not show up properly," what exactly do you mean? How are they not showing up properly?

I set up the "short" mod to return the records in one table, with each record as a cell in the table. It does work if you keep the structure the way I have it, which includes starting the html_record subroutine with a <TD> tag and ending it with a </TD> tag.

Possibly you found your problem after you posted here and fixed it. (That happens a lot! Smile ) But right now, I don't see the problem at all.


------------------
JPD





Quote Reply
Re: Mod for different search results??? In reply to
Okay...I am having problems getting the short and long formats to work. I have deleted all records in the database (based on the assumption that the db file could have been corrupted). I have added two test records.

I did follow the instructions in the "short.txt" file. Yet I reverted back to most of the original coding in the sub-routines for deleting and modifying because they did not work properly.

I added in the following codes in the "view_success" sub-routine:

if ( $db_total_hits == 1 ) {
%rec = &array_to_hash(0, @hits);
&html_record_long(%rec);
}

else {
for (0 .. $numhits - 1) {
print "<P>";
&html_record(&array_to_hash($_, @hits));
}
}

I am getting REALLY screwy results. The first record shows up fine. The link works and the LONG VIEW shows up. However, procedding records do not show up properly.

To see this in action, go to:

http://www.coco.cc.az.us/cgi-bin/directory/

Click on the "List All" link and you will see the results.

I have saved the html.pl file in text file if you'd like to attempt to debug the file. It is located at:

http://www.coco.cc.az.us/cgi-bin/directory/htmlpl.txt

BTW: I am going bald from this problem because of all the hair I've had to pull out!!

Any assistance would be most appreciated!!

Thank you.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Mod for different search results??? In reply to
Hi there. Well, I fixed it. I really don't know what I did to fix it. :-)

The problem with session is that I deleted out a bunch of sessions from the auth/ directory.

I also added in the compacted table option. It is working very nicely now.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited May 12, 1999).]