Gossamer Forum
Home : Products : DBMan : Installation :

Code Update for "Add a Graphic Mod"

Quote Reply
Code Update for "Add a Graphic Mod"
Pirate I was having a particular problem with the mod that allows DBMan to upload a graphic, as downloaded from JPDeni's web site. If the "show a default graphic code" was put into place, the actual default graphic that I had uploaded to the server wouldn't show up if more than one database entry was returned when the "list all" link was used (assuming your returned list of search entries in the default.cfg file was set at 2 or more and one of the returned entries had a valid graphic associated with it).

If anyone was, or is, having the same problem, I believe the following changes will correct the coding error.


directly after the entry of:
$db_key = 'ID';

in the default.cfg file, I adding this entry:
$db_graphic = 'Graphic';

(this assumes that the database column where the default of "Yes" is inserted, when a graphic is uploaded, is called "Graphic")


Rather than use this code:

unless ($graphic_found) {
print qq|<img src="http://yourdomain.com/default.gif">|;
print qq|

simply change it to this:

$file_read = $rec{$db_graphic};
if ($file_read =~ / /) {
print qq|<img src="http://yourdomain.com/default.gif">|;
print qq|

I believe the problem with the original code was that it checked all returned searches for a graphic and if one was found, it didn't print the default graphic. OK so far. But, if you returned two search listings, one with a graphic and one without, the original code saw or incorrectly assumed that a graphic had been found, and it then DIDN'T print the default graphic in the returned search entry that didn't have a graphic associated with it.

The above corrected code doesn't look at the returned search listings. Rather, it reads the database for an empty space in the database's "graphic column".

By default, JPDeni's code doesn't place an entry in the "graphics column" if you don't upload a graphic. No Graphic Upload, No Database Entry. If you upload a graphic, then the default code in the mod places a "Yes" in the graphic column.

By looking for the empty space in the database's graphic column, the above code will return your default graphic for EVERY returned search listing that doesn't have a graphic associated with it.

Whether it was my ISP's server that didn't like the original code and wouldn't return the default graphic correctly, or whether the code had an oversight in it, I hope this correction will help any other folks that are or were having the same problem that I was.

I would like to thank Lois C and Karen for previously taking their time to help me (and I'll probably need more) as "I blindly go, where no Newbie has gone before". hehehe