Gossamer Forum
Home : Products : DBMan : Customization :

db key cause for modify problem?

Quote Reply
db key cause for modify problem?
I am having problems with Feilds 0 and 1.
Feild 0 is the name of person which they input AND is also the key. The problem is that the name also goes into feild 1.

Should the Key be its own field? Is the key causing the problem here?

I posted my source code on the feilds and someone mentioned everything else looks good.
That is why I am looking at key field. This feild is also mandatory to input.

I also noticed that if I log in as an admin, I can modify feild 1 and it stays..i think.

Not sure what to do. I have gone through html_record and html_record_form and made sure the field names match and the amount of them. I will go over them again in more detail. (There are 46 fields total.)

Quote Reply
Re: db key cause for modify problem? In reply to
In addition to my previous question, is there a limit to the length of a field name?

This is not a way to spend a friday evening! This was due to my boss earlier today. Did not happen! :-) or is that :-(
Quote Reply
Re: db key cause for modify problem? In reply to
Ok, what it is doing is putting the person's login name into field 1 which is PROGRAM
Quote Reply
Re: db key cause for modify problem? In reply to
tm,

Preferrably, the ID should be its own record. Everything should be its own record, actually. If for no other reason than it makes it easier to use. Smile So in this example, field 0 (most ideally) should be the ID, and 1 should be their name.

You also wouldn't want to use a person's name as a record ID, as each record has to have its own unique ID.

Hope that helps, guy!

--Lee
Quote Reply
Re: db key cause for modify problem? In reply to
I have created a separate ID field like the demo originally had.

It didn't solve the problem but made me realize what is happening.

DBman is putting the login username into field 1. I changed the name of field 1 incase i was using a name that conflicts with program variables, but it still does that.

Anyone know how to deal with this one?
Quote Reply
Re: db key cause for modify problem? In reply to
 
Quote:
I changed the name of field 1 incase i was using a name that conflicts with program variables

I am confused. If you have a routine that puts user login information, then you would want to leave the name of field 1 the way it is, so you won't have any errors accessing it.

Could you post your default.cfg file as defaultcfg.txt and put it on a server where I could access it? I'd like to take a look at it if I may to see if I can find where the error is.

--Lee
Quote Reply
Re: db key cause for modify problem? In reply to
I dont want the person's log in username posted in field 1. I don't know how it is getting inserted into there.

Here is default.cfg file...

http://www.bio.psu.edu/goingcrazy/default_cfg.txt

thanks,

Tim
Quote Reply
Re: db key cause for modify problem? In reply to
I looked just to be sure, but when I read

Quote:
I dont want the person's log in username posted in field 1. I don't know how it is getting inserted into there.

I was pretty sure what the problem is. I checked your .cfg file just to be sure.

You have

$auth_user_field = 1;

That will cause the userid to be inserted into the field. If you don't have a field for userid, you need to set this to

$auth_user_field = -1;

That will solve your problem.



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






Quote Reply
Re: db key cause for modify problem? In reply to
ok, now it won't display anything and when i selct modify, i get an error saying

Error: no matching records.

Should I use that i just disabled function? can I use it as a key field?
Quote Reply
Re: db key cause for modify problem? In reply to
The "no matching records" when you modify is caused by a problem with the $db_key. It's not finding the record from the key value that was passed to the script.

Do you have a lot of records in there already? You might need to start with a completely new .db file, since you've changed some of the fields.

Also, are you certain that you have included every field in your html_record_form, including the hidden ones?


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






Quote Reply
Re: db key cause for modify problem? In reply to
Did you change the name of field 1 back to its original value? Also, have you checked the db file to make sure it contains the proper number of fields in it?
Quote Reply
Re: db key cause for modify problem? In reply to
when i changed the name of field 1, i also changed it in the two subroutines in html.pl, so there were no errors.

i have printed out default.cfg, and the 2 sub s in html.pl and compared # of fields and made sure names matched. there is 40+ pages in there but have gone over it 3 times. :-)




Quote Reply
Re: db key cause for modify problem? In reply to
I do not have any hidden fields. Should I?

Is the submit button one? That is incorporated into the program though. I have not touched that.

I'll go through it again.
Quote Reply
Re: db key cause for modify problem? In reply to
Can I use the following feature as the key field in field zero? If the following is set to -1 i cannot modify recds.

# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = 0;
Quote Reply
Re: db key cause for modify problem? In reply to
Actually, if you do that it will assign the auth_user field to field 0. Won't work. You could always create a new field at the end for the auth_user field. I'm still at a loss as to why you can't set it to -1 without getting errors. Give me some time, I'll try and figure something up if no one else does first. Wink

--Lee

Quote Reply
Re: db key cause for modify problem? In reply to
If i do use it for field zero..and as a key

do i need to change the name of the field to userid? or do i delete it since it automatically inserts it? If i delete it, should i delete it from html.p subroutines?

ID => [0, 'numer',5,8, 1,'',''],
Quote Reply
Re: db key cause for modify problem? In reply to
You need to be certain that sub html_record_form has an input field for every field listed in your .cfg file.

When you add a record, is the ID field filled in on the form? After you add a record, does the record show up on the add_success page?


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






Quote Reply
Re: db key cause for modify problem? In reply to
I think I know what the problem is. You have

$auth_modify_own = 1;

and you have no userid field. That's why it wouldn't work correctly.

If you want users to only be able to modify their own records, you need to set

$db_key_track = 0;
$auth_user_field = 0;

or you need to add a userid field and set

$auth_user_field

to the number of that field.

The choice would be whether you want users to be able to add more than one record or not. If not, do the first choice. If so, do the second.


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






Quote Reply
Re: db key cause for modify problem? In reply to
actually it is working. when you add a record, field 1 will say "1" and then after you submit it, it will put in userid. i don't mind having userid in field zero, as it is more appropiate then just a random number.

But i have a bit of uncertainity that there is just a tiny glitch somewhere because i get errors when that setting is set to -1.

When i orginally configured it, i misinterperted what it meant.

Is there a way so the key field cannot be changed? that is when you modify, it shows in a box like all the other fields.

Thanks for all your help.

Tim
Quote Reply
Re: db key cause for modify problem? In reply to
ok it is working better now.

i have both settings to 0. so now they have to input their own id? will they know what they really means.

Can i set Auth user field to 1 and put it in field 0 as a key field?
Quote Reply
Re: db key cause for modify problem? In reply to
They won't have to enter their userid. If

$auth_user_field = 0;

is set in the .cfg file, the script will automatically insert the userid into field 0.

If you set

$auth_user_field = 1;

the script will insert the userid into field 1.


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






Quote Reply
Re: db key cause for modify problem? In reply to
yes, field zero, that is what i meant.
I currently have

ID => [0, 'numer', 5, 8, 1, '',''],

for field 0. and the 'ID' fields in the html.pl

should that be deleted now, or just leave it?
Quote Reply
Re: db key cause for modify problem? In reply to
Change the field definition to

ID => [0, 'alpha', 5, 8, 1, '',''],

since your userids are alphabetical. Then leave it as it is.

You might want to make the field a hidden field in your form, so users don't even know it's there.



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