Gossamer Forum
Home : Products : DBMan : Installation :

DATA CHECK FOR OLD ENTRY

Quote Reply
DATA CHECK FOR OLD ENTRY
Is there a way to tell in dbman that
the record was entered before
or compare if the same record exist
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
How many fields do you want to check?


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
pROBABLY 4 ?
But will it work as a archive
Maybe this will add litle sun to my question

1.The user will add a record after 30days i can put this record to archive to be display on search but if i decide to not putting on a search but just keep in (HIDDEN ARCHIVE)
without deliting it.
ACTION:
Customer wants to add the same record but instaed of adding displays "please contact admin for your submission".

2.the customer want's to add the same record
(RECORD ALREADY EXIST IN DB)
ACTION:the system checks the db and dispalay massage "the record already exist on the systemPlease contact admin at whoever@notme.you"
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
This is going to be really complicated to do. Is your "hidden archive" still within the same database? Or do you want to check two different database files?

I'm sure it can be done, similar to checking for a duplicate id when validating records. It's just that it has to look at four fields in every record every time a new record is added. And if you have a separate database, it will have to look at all the records in there too.

I just want to be as clear as possible on what you want before I try to work out the code you're going to need. Also, the field numbers will be hard-coded into the script and you won't be able to change your mind later without editing the script again. (Just want to be clear on what you're going to be dealing with.)


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
if possible the archive ting
if not the code that allows you to check if
file was added before based on 4 fields.

Damn but i want so people will add their record in couple states so this will not work

Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
here is exactly what i want to do:

I want companies to add their record to my database after they do if they want to be displayed in other category (By states)
they can add automaticly all their submission to that category (another State)
so when people search for nj their record will show ,when NY the record will show too
so they can add their record to as many categories as they want.

After they added record thank you page will display with record and how many state they choose.
when they log in it tells them In how many
States their record is bein display.
now when they want to add their company to
the same state it tells them that record already exist in this category (state)

Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
I would think that each company would be entered by only one user, right? If so, you can just set the $db_key to the user id field and it will automatically check to see if a user has a record already in the database. (Be sure to set $db_key_track to 0 if you do this!)

You have one database will all of the records in it and then 50 more databases with the same records (one for each state), right? In order to show a list of the state databases that have the records in them, you'll have to search through each of the 50 databases whenever a record is added.

Are you sure you need to set it up this way? Seems like there should be an easier way to do it.


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
No not 50 databases!
1 Database

company nj Devils , NJ Devils
city elizabeth Elizabeth
state NewJersey NewYork
zip 07220 07220
phone 9083544454 9083544454
fax 969969969 969969969
email me@mycom.net me@mycom.net
descript mysite my site
url www.my.net www.my.net
-------
company decide that they want it's record
in two STATES . NJ and NY
So it adds it record to NJ listings
than add this same submission to NY listings.

Search is done by State so when client wants to see which company is in NY the company will display

If they want to see NJ they see this same company in NJ

1.NOW How can i do it?
What are my options?

2.How can they automaticly add their company to Second state without retyping all info

3.When Client log in to database wants to add record to State NJ (Record already Exist)
So the dbman tells him."Opps Your company arleady exist in This state.

Thanks JDP .I know i'm pain in a butt
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
Okay. I think I have it now. Smile (Sorry. I'm a bit slow sometimes.)

The easiest way to do this is to use a multiple select field.

Add the following to your db.cgi script

Code:
sub build_multiple_select_field {
# --------------------------------------------------------
# Builds a SELECT field based on information found
# in the database definition.
#
my ($column, $value, $size) = @_;
my ($size, %values);

$name | | ($name = $column);
$size | | ($size = 1);

@fields = split (/\,/, $db_select_fields{"$column"});
%values = split (/\Q$db_delim\E/, $value);

($#fields >= 0) or return "error building select field: no select fields specified in config for field '$column'!";

$output = qq|<SELECT NAME="$name" MULTIPLE SIZE=$size><OPTION>---|;
foreach $field (@fields) {
$values{$field} ?
($output .= "<OPTION SELECTED>$field\n") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";
return $output;
}

You'll need to have a select field defined in your .cfg file with all the states in it.

Also, it would be a very good idea to have separate input and search forms. Use the multiple select field for the input, but a "single" select field for the search.

To print out the multiple select field, use

print &build_multiple_select_field("State","$rec{'State'}",3);

The 3 above is the size of your select field.

I haven't used this directly, but I've used something similar that worked very well.



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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
do i have to change anything in here
and where should i put the second line

Cause is not working
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
What isn't working? Do you get a CGI error? A 500 error? Does the select field not show up? Are the entries not included when you add? Do they not show up in search results?

There are lots of possiblities, each one with a little different approach to fixing the problem. I need more information before I can answer your question.


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
Ok i have 500 internal server error!

now ididn't add :
print &build_multiple_select_field("State","$rec{'State'}",3);
This line where should i place it?
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
My fault. I keep forgetting that UBB adds spaces between two | characters. Take out the spaces between the &#0124; &#0124; characters and you'll get rid of your 500 error.

As for where to put the

print &build_multiple_select_field

line, it goes in html_record_form, where you would put a

print &build_select_field

line.

Are you using autogenerate? (It just occurred to me that you might be.) This won't work with autogenerate.


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
No Im not using autogenerate.
OK IT IS WORKING

But one question this is for multiple states
but how do the whole record is add to another state (if They chose to )
Shouldn't there be another link in the html_add_success that say Q."add your company to another listing" and then let them Chose another state and submit.

Whebn i insert that line in html_record_form
it does not do anything

the original choosing worked fine (i had the pull down choos option)


Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
If we can get it to work, the user will be able to select multiple states when he adds the record. So if, for example, the user wanted to select NJ, NY, MA and RI, he could do that. All he needs to do is hold the control key down while he makes the his choices. You may want to put in an instruction -- "To select multiple states, hold down the Control Key while you make your selections."

All the choices will be included in the field, so that if another user comes on and wants to find a record that has MA listed, the record will appear.

You probably have

print &build_select_field("State","$rec{'State'}")

in your html_record_form. Replace that with

print &build_multiple_select_field("State","$rec{'State'}")


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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
Ok JPD Works great .
Sorry to bombard you with the questions
But here is one more.
Now that i have this done how can i be notify (i tried the mail dosen't want to work for me)
which companies added they record and to which state?

Thanks a lot for all.
P.S How can i type pipe Il sick of pasting
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
Well, first you need to find out if the program "sendmail" is on your system. If it isn't there are other ways to send email, but I'll have to look into them.

I'm not sure I understand your last question. Are you looking for the | character on your keyboard? Different keyboards have it in different places. Mine is just above my "Enter" key. (It requires the "shift" to use it.) Other keyboards use a key on the top row -- where the numbers are. Just look closely at all the keys on your keyboard and see if you can find it.

Glad the multiple select worked for you. Smile

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





Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
how can i find out if "sendmail is on my sys?
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
If you are on a Unix or Linux server, you'll most likely have sendmail installed. If you are allowed to telnet (shell) in, at the command prompt, type:
whereis sendmail

It will tell you the path to where the sendmail program is installed.
Quote Reply
Re: DATA CHECK FOR OLD ENTRY In reply to
OK i got it
/usr/sbin/sendmail