Gossamer Forum
Home : Products : DBMan : Installation :

Problem after modifying fields

Quote Reply
Problem after modifying fields
I have a problem after I edited the fields in DBMAN, this is the default.cfg file that I have edited to :

# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']

%db_def = (
ID => [0, 'numer', 10, 8, 1, '', ''],
URL => [2, 'alpha', 40, 255, 1, 'http://', '^http://'],
Artist => [3, 'alpha', 60, 60, 1, '', ''],
Title => [4, 'alpha', 60, 60, 1, '', '']

);


so now I have 4 fields:
- ID
- URL
- Artist
- Title

In html.pl I have edited the folowing:


my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

my $font = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="8" MAXLENGTH="8"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>URL: </FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="URL" VALUE="$rec{'URL'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Artist:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Artist" VALUE="$rec{'Artist'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Title:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Title" VALUE="$rec{'Title'}" SIZE="40" MAXLENGTH="255"></TD></TR>
</TABLE>
|;
}

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'ID'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Title:</FONT></TD>
<TD> <$font>$rec{'URL'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>URL: </FONT></TD>
<TD> <$font><A HREF="$rec{'Artist'}">$rec{'URL'}</A></Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Type: </FONT></TD>
<TD> <$font>$rec{'Title'}</Font></TD></TR>
</TABLE>
|;
}

The problem is things are messed up because on the place where title is (field #4) it says after adding a record `Type` but I removed already type and it displays the url instead of the title and the artist displays the url instead of artistname and the url displays the title

How come???? please help me
thank you,
David
Quote Reply
Re: Problem after modifying fields In reply to
First of all, you need to re-number your fields starting with 0 and ending with 3, like the following:

Code:
ID => [0, 'numer', 10, 8, 1, '', ''],
URL => [1, 'alpha', 40, 255, 1, 'http://', '^http://'],
Artist => [2, 'alpha', 60, 60, 1, '',''],
Title => [3, 'alpha', 60, 60, 1, '', '']

Secondly, you have to delete the Type field spacing in your existing database file. If you don't then your database file will be corrupted and it will not print the fields correctly.

So, your database file should look like the following:

Code:
1|http://www.mydomain.com/|Michael|Cool Site

NOT like the following:

Code:
1|Web|http://www.mydomain.com/|Michael|Cool Site

To delete the Type field from your existing database, you can use EditPlus (www.editplus.com) or another text editor to delete the delimiter character and value in that field space.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------