linuxis
04-07-2006, 04:28 PM
I use the following lines to store some values into a database. It works fine, and the script gives an warning if a name allready exists in the db.
Though I got the following problem, the value of the main key of the database ($go1) aint stored in uppercase or lowercase. Let's say the name 'hello' is in my database, and someone else stores 'HELLO' in it, my script wont see there is allready an hello in the db. I don't want to save the names in uppercase cause I need them later in their original state, and throwing in an extra field (name in uppercase) seems a little silly to me.
Hope you guy understand what I mean
tie(%map, 'SDBM_File', 'spiral.sdbm', O_RDWR|O_CREAT, 0666) or die "error: $!; aborting";
$error_rep = 1 if $map{$go1};
if ($error_rep<1){
$string = join("\t",$go1, $go2,$go3
$map{$go1} = $string;
print "stored";
}else{
untie %map;
print qq{Name allready exists, please choose another.<br>};
&show_html;
}
untie %map;
Though I got the following problem, the value of the main key of the database ($go1) aint stored in uppercase or lowercase. Let's say the name 'hello' is in my database, and someone else stores 'HELLO' in it, my script wont see there is allready an hello in the db. I don't want to save the names in uppercase cause I need them later in their original state, and throwing in an extra field (name in uppercase) seems a little silly to me.
Hope you guy understand what I mean
tie(%map, 'SDBM_File', 'spiral.sdbm', O_RDWR|O_CREAT, 0666) or die "error: $!; aborting";
$error_rep = 1 if $map{$go1};
if ($error_rep<1){
$string = join("\t",$go1, $go2,$go3
$map{$go1} = $string;
print "stored";
}else{
untie %map;
print qq{Name allready exists, please choose another.<br>};
&show_html;
}
untie %map;