Gossamer Forum
Home : General : Perl Programming :

Modifying a registry in a database

Quote Reply
Modifying a registry in a database
  I have a database with IDs, username, password, site description, etc...
What I want is to according to a user entry modify his information. I tried the following code:
Code:
open (DB, "<$arq_membros") or &cgierr("Erro em modificar em cadastrar.cgi. Impossível abrir arquivos db: $arq_membros. Motivo: $!");
$found = 0;
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = split(/\|/,$_);
if ($data[1] eq "$in{'usuario'}") {
if ($data[6] eq "$in{'senha'}") {
$temp_data = join ("\|",$data[0],$data[1],$in{'url'},$in{'banner'},$in{'nome'},$in{'email'},$data[6],$data[7],$in{'descricao'},$data[9],$data[10],$data[11]);
$temp_data .= "\n"; $found = '1'; $new_data .= $temp_data;}
else { &site_html_add_failure ("Senha incorreta"); exit; }
}
else { $new_data .= @data; }
if ($found) { last LINE; }
}
close DB;

But with this, when the routine find the username, it modifies it but all the information that comes after this line is lost.
What to do know???
Subject Author Views Date
Thread Modifying a registry in a database tmoretti 3444 Jun 18, 1999, 12:54 PM
Post Re: Modifying a registry in a database
tmoretti 3279 Jun 19, 1999, 7:06 AM
Post Re: Modifying a registry in a database
Bobsie 3289 Jun 19, 1999, 1:40 PM
Post Re: Modifying a registry in a database
tmoretti 3289 Jun 19, 1999, 1:53 PM
Post Re: Modifying a registry in a database
Bobsie 3283 Jun 19, 1999, 2:16 PM