Gossamer Forum
Home : Products : DBMan : Customization :

Username added to a db field

Quote Reply
Username added to a db field
hi,

well what i basically did was to add some more fields to the database definition in the cfg file. the problem is that when i add a new record all fields but one work just fine displaying what i entered before. that one field stores the user's name even though i didn't enter it, it just overrides my data.
it's not a displaying problem, but within the adding process already, cos the db stores for example "admin" in that field when the admin added that record.
same for other test users.
i couldn't eliminate the problem by now, so i thought it might be a good idea to request help here.

<TR>
<TD ALIGN="Right" VALIGN="TOP" width="104"><div align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#003366">Version:</font></b></div></TD>
<TD ALIGN="Right" VALIGN="TOP" width="30"><div align="left"></div></TD>
<TD VALIGN="TOP" width="311"><div align="left"><INPUT TYPE="TEXT" NAME="Version" VALUE="$rec{'Version'}" SIZE="40" MAXLENGTH="255"></div></TD>
</TR>
<TR>
<TD ALIGN="Right" VALIGN="TOP" width="104"><div align="left"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#003366">Dummy:</font></b></div></TD>
<TD ALIGN="Right" VALIGN="TOP" width="30"><div align="left"></div></TD>
<TD VALIGN="TOP" width="311"><div align="left"><INPUT TYPE="TEXT" NAME="Dummy" VALUE="$rec{'Dummy'}" SIZE="40" MAXLENGTH="255"></div></TD>
</TR>

these are two lines from my sub html_record_form routine, which only differ by the db field in my eyes, so i don't get what's goin on. i tried to test if it is always the last field that has that problem, but when i would add another row same definition, different name, then still the dummy field isn't workin.

%db_def = (
'ID' => [0, 'numer', 5, 8, 1, '', ''],
'Title' => [1, 'alpha', 40, 255, 1, '', ''],
'URL' => [2, 'alpha', 40, 255, 0, 'http://', ''],
'Type' => [3, 'alpha', 0, 60, 1, '', ''],
'Date' => [4, 'date', 12, 15, 1, &get_date, ''],
'Category' => [5, 'alpha', 0, 255, 1, '', ''],
'Description' => [6, 'alpha', '40x3', 99999, 0, '', ''],
'Author' => [7, 'alpha', 40, 255, 0, '', ''],
'Version' => [8, 'alpha', 40, 255, 0, '', ''],
'Dummy' => [9, 'alpha', 40, 255, 0, '', '']
);

that's my db definition.

maybe someone had that problem before or can tell me where the problem comes from.

thx in advance & best regards ! :)


Quote Reply
Re: Username added to a db field In reply to
1) You need to update your default.db AFTER you add fields to your %db_def hash. Simply adding a field in the %db_def doesn't do it. If you already have records in your default.db file, you need to add a delimiter to the end of each line in your default.db.

2) If you are adding the userid field in your database via the %db_def hash, you also need to update the following variable:

Code:

$auth_user_field = -1;


Change -1 to the field number of your username field.

Regards,

Eliot Lee


Quote Reply
Re: Username added to a db field In reply to
thx, that helped me a lot !
solved my problem actually.

it was clear to me that i have to update my db file though, that wasn't the problem. point 2 did what i needed.
that variable was set to 9, so that dummy field, which is at position 9 stored the userid, but i don't wanna use the userid in any of the fields, so i set it to -1.

workin perfect now, thx Man, i owe ya sumfin !

best regards !!!