Gossamer Forum
Home : Products : DBMan : Customization :

relational mod problem :(

(Page 1 of 2)
> >
Quote Reply
relational mod problem :(
I have been setup this mod for DAYS, but still don't have any progress. :(

I followed the instructions in the txt file and forum, but whenever I add a new record the values won't insert to the "many" db. pls take a look at the scripts, i'm using the user freindly html and short/long display.
the files and be view from http://sirboss.tacoshell.com/temp


auth.pl
db_cgi.txt
default.log
default.pass
features.db
features_cfg.txt
features_html_pl.txt
format_pl.txt
look.txt
provider.count
provider.db
provider_cfg.txt
provider_html_pl.txt

sirboss.tacoshell.com/cgi-bin/dbman/db.cgi?db=provider

I have no idea how to include a link to another page from the long display, this page will get its info from the "many" db, how do i modify it ? Confused :(

thanks



Quote Reply
Re: relational mod problem :( In reply to
As I mentioned in your other thread about the relational mod, first you need to test each database separately to make sure there are no errors in it. Have you done that?


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
yup

Quote Reply
Re: relational mod problem :( In reply to
Okay. Now, which is your "one" database and which is your "many"? It seems that you have three databases going. Right now, we'll just work on two of them, to avoid as much confusion as possible.


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
3 db ? i have only 2 db

the "one" db is provider.db and the "many" db is features.db

i wish to create a link in the long display that will ouput the contents of features.db

Quote Reply
Re: relational mod problem :( In reply to
I guess I looked at the filenames and saw "default." I thought you had three.

You're in the "one" database -- provider -- and you want a link to print out all of the records that match from the "many" database -- features.

Your link would look like
< a href ="$db_script_url?db=features&uid=$db_uid&$db_key=$rec{$db_key}&view_records=1">

However, you're not going to get very far with that, since your features database cannot possibly work.

You have a syntax error in your features.cfg file, which means that the script won't even run when you try to access that database.

In your .cfg file is

Domain => [12, 'alpha', 0, 1, 1, "', ''],

It needs to be

Domain => [12, 'alpha', 0, 1, 1, '', ''],

Another problem with your .cfg file is

Setup => [7, 'alpha', 0, 1, 1, 'Yes', 'Yes|No'],

The maximum length for entry in the field is 1 character, yet you have a default value that has three characters. And the only other acceptable option has two characters. No record can be added to the database as long as there is this discrepancy.

You have about 25 fields that appear to be checkbox fields, but you don't have anything in the % db_checkbox_fields section. Or the radio fields or the select fields.

You have $db_auto_generate = 0;, yet your features_html.pl file has not been touched. It is just the default (user-friendly) file.

All of which means that, if you add the link I gave you above, you're not going to get any results. Which is why I asked you in the first place if you had tested your databases to make sure they worked.

When you have everything fixed and your individual databases are working, then I'll help you more with the relational mod. If you need help with the databases, just ask.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
thank u, for pointing out the fault
i will correct it now

:)

Quote Reply
Re: relational mod problem :( In reply to
i reinstall the dbman, now there r 2 db

"one" db = provider.db
"many" db =features.db

the provider_html.pl is the user-friendly html.pl with short /or long display and the other html.pl for "many" db is only the user friendly html.pl without any additional mod. how ever i have problem add a record, After some field, some invalid error pop-up, the fields r "promotion" on "one" db and "OS" in the html.pl fot features.db.

pls assist me :)

thanks

Quote Reply
Re: relational mod problem :( In reply to
In your features.cfg file, you have

OS => [9, 'alpha', 30, 3, 1, '', ''],

You didn't say what errors you're getting (it's always helpful to know what the error message is), but it could be that the entry is too long. You have set up a 30-character input field, but you only are allowing 3 characters to be input into the record.

Regarding your provider.cfg file and the "Promotion" field, the problem is being caused by the fact that you have not changed

$auth_user_field = 9;

It needs to be

$auth_user_field = 1;

Also, your

$auth_logoff = $db_dir_url . "?db=provider";

Will not work correctly. It will work if you use

$auth_logoff = $db_script_url . "?db=provider";

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
thanks carol, i have corrected all the problem and now i can add records to the 2 db successfully , however how to input a 'NO' when the checkbox is not checked ?. thank u

Should we start to proceed to the relational mod ?

:) Carol , i seen to online at 4 am, is that true ?

Quote Reply
Re: relational mod problem :( In reply to
To print a "NO" when nothing is checked, in sub html_record use the code:
Code:
if (!$rec{'FieldName'}) {
print "No";
} else {
print "$rec{'FieldName'}";
}
Just change the FieldName's to the field name with the checkbox.

As for the time, it is generated by the web server, so it may not be accurate to your local time. It certainlyt is'nt 9pm where I'm sitting Smile

- Mark

Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: relational mod problem :( In reply to
Well, for me, the time on the forum is the time where I live. I'm in the same time zone as Gossamer Threads (100 miles or so away). I am often up at 4am answering questions.

If everything is working all right in both your databases, I'm willing to help you on the relational mod.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
I want to the value "NO" automatically insert to the database , if the checkbox is not checked

Quote Reply
Re: relational mod problem :( In reply to
If you want to set a default value for your field, you would set that up in your .cfg file.

Such as:

Fieldname => [7, 'alpha', 0, 1, 1, 'No', 'Yes|No'],

This will force the default of no for the field. Change "Fieldname" to the name of your field.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: relational mod problem :( In reply to
If you want to have two mutually exclusive options, you should use a radio field instead of a checkbox field.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
won't work
the reply is the field must be filled
the "NO" value won't insert automatically


Quote Reply
Re: relational mod problem :( In reply to
What do you mean "it won't work." Of course it will work.

If you set up a radio field that has the options "Yes" and "No" and you set the default value for the field to be "No," then "No" will automatically be entered into the field.


JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
actually, this is what i want in the features.db

the features.db will contain all the features of a webhost package. If a web host offer that kind of feature in their package (eg : Mailing list ) then a "checked" image will be display beside the word like this one

http://www.hostindex.com/ShowFullRecord.asp?ID=catsupport

So ,i the form, i should use checkbox, because they may have all the features.

also , i couldn't get a 'NO' insert to the db, it said the field could not be left blank

what is the best way to do this ?



Quote Reply
Re: relational mod problem :( In reply to
it is a check box , not a radio field

Quote Reply
Re: relational mod problem :( In reply to
I know it's a checkbox. But if you want one of two mutually exclusive options to be in the field, you need to make it a radio field instead of a checkbox.

I think your real problem is that you are requiring the checkbox to be checked. You need to set the not_null value for checkboxes to 0.

In the %db__def section, make all of your checkbox fields have the following format in the %db_field_def section:

Webdesign => [ 1, 'alpha', 0, 3, 0, '', 'Yes'],

That will make your checkboxes work.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
carol, even i don't require the checkbox to be checked, the value is not the default value, it return a null value,

how do i modified the &sub build_checkbox_field to allow a default value return to the db, when it is not checked ,

the original dbman , also return a null value when is not checked

i wonder is anybody have this problem

how can i display an image to represent the value instead of displaying the value "YES" and "NO"

thank u

Quote Reply
Re: relational mod problem :( In reply to
In Reply To:
how do i modified the &sub build_checkbox_field to allow a default value return to the db, when it is not checked
You don't. That is the nature of checkbox fields. If the box is checked when the record is added, a value is inserted into the record. If not, nothing is inserted into the record. If you want "No" to be entered into the record, use a radio field.

We'll worry about image display after you understand this.

JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: relational mod problem :( In reply to
I know i should use radio field :) but i wish my form could appear like this. the example is on http://sirboss.tacoshell.com/temp/example.htm

here is how the form and the database function :

1. the user check the checkbox based on their services offered

2. the checkbox can be blank

3. when a user request a record, it would print out a "tick" to represent the services offered by the host.

4. As you know , radio field cannot allow multiple choices, but checkbox does

pls give me some suggestion :)

from hd2000


Quote Reply
Re: relational mod problem :( In reply to
should we start to install the relational mod
everything is ok


Quote Reply
Re: relational mod problem :( In reply to
What do you need?

JPD
http://www.jpdeni.com/dbman/
> >