Gossamer Forum
Home : Products : DBMan : Customization :

Help please! User Dependant Field

Quote Reply
Help please! User Dependant Field
Hi,
I read this http://webmagic.hypermart.net/dbman/field24.txt and found that its exactly what I want to do, the reply to this was
"To get the info from the users database, use:
&switch_to_users;
%rec2 = &get_record($db_userid);
&switch_to_whatever it was before
in sub html_record_form, after
my (%rec) = @_;
Then use $rec2{'FileName'} for the information from the users database."
But when I put this in, the cgi just falls over. Is this the right script to add? Am I adding it right? All I want is a dropdown menu dependant on the user.
Any help would be greatly recieved
Ben
ben@hot-key.com

Quote Reply
Re: Help please! User Dependant Field In reply to
Hi Ben, tried going to the url you had given me earlier, wasn't able to locate the files, I know it's been a while. The abbreviations you've used in the files aren't intuitive for knowing which field is which for anyone not familiar with the abbreviation protocals. I have a bit more time available now and would be able to take a look at your files again if you'd be able to save them as text files and upload them somewhere accessible via the web.

Quote Reply
Re: Help please! User Dependant Field In reply to
Hi,
I uploaded the files to http://www.crescentbeachhotel.com/dbman/ should still be there...lemme just check...yep, they're a bit out of date, but they are there. I'll upload the most recent files now. Thanks for the help. All I want to do is have 1 field (room type) dependant on which user logs in. i.e. user1 gets 1 set of options, user2 gets another set of options.
Ben

Quote Reply
Re: Help please! User Dependant Field In reply to
Hi Ben, I've tried uploading your files to a test server - the install has gone okay however, it is not obvious to me how/where you are creating the "users" or their preferences. Is there another set of scripts you are using to interact with these files?

Quote Reply
Re: Help please! User Dependant Field In reply to
Hi Karen,
Thanks for helping, the records are inserted into the default.db, which I have now uploaded. And the user id is in the default.pass (also uploaded). If possible I'd like to extract the room types from roomtype.db depending on which user logs in, and insert them into default.db (if that makes any sense)
Thanks again
Ben

Quote Reply
Re: Help please! User Dependant Field In reply to
Ben, do you have a configuration and html.pl file for the users? By looking over your files, it appears you have portions of a relational database in the works. Problem is, I don't see where there is a user database configuration to provide the dropdown options you would like to have as a search function.

The dropdown options you would like to have are in the roomtype file you've created, but there is no config file to reference for switching routines needed to get the content.

I know you've been working on this for some time and not seeming to get anywhere on what you'd like to do. My suggestion would be to:

Create a user database -
You can have this database initially have just one required field 'Room Type' for example. A default user could "login" using just a link from your site, browse the options, check available locations, etc (guessing on what you're trying to do) and if a suitable location is found in the search, then complete the rest of the user db fields to create an actual record entry.

At the very least, it seems you need fields for userID, Bed Type, and Room Type in a config file.

I could be way off on this and in reality you may want only user001, user002 & user003 in your roomtype db whereas in that even, simply the little database you have made would suffice.

Unfortunately, without having the switch_to routines, I would be at a loss in suggesting ways to open that file, access options, and create dynamic dropdowns for use in dbman.



Quote Reply
Re: Help please! User Dependant Field In reply to
Hi Karen
The html.pl and default.cfg file should be on the server as html.txt and default.txt. At the moment all users have the same room types, which comes from the default.cfg

%db_select_option_fields = (
RTY => 'Deluxe Double|A1K,Deluxe Twin|A2T,Junior Suite|ATS,Suite|AS1,Double|B1K,Single|B1T,Twin|B2T'

The above is because I want 1 thing to be shown in the dropdown menu, but another to be entered in the database! For example, they select Single, and B1T is entered into the database. I know this probably makes it even more complicated.
What I was thinking of, was in the roomtypes.db was like this.

user001,Double|A1K,Twin|A2T,Suite|AS1,Single|B1T

This way user001 is given options of Double, Twin, Suite and Single, if he chooses Twin, then A2T is entered into the default.db. This is all I need, no bed types or anything, just userid and room types. The hopefully I can do something like if userid = the 1st field then print field 2,3, & 4 etc.
Thanks for helping, your a star
Ben