kennymoens
New Member
I'm running a mySQL database, this is accessed through Perl.
Now I'm writing a module to update some of the records of the mySQL database.
Until here it works perfectly, now the script submits data through a form, I'll read it out and update the tables:
So the first table isn't updated with the data, all the other tables are. I can't find the error, do you find it?
Now I'm writing a module to update some of the records of the mySQL database.
Code:
# First open connection to database (variables are definied) #
$dbh = DBI->connect($DSN,$user,$pw);
# SQL Commando #
my $query = "SELECT * FROM roster";
my $sth = $dbh->prepare($query);
$sth->execute;
#-> Here is the code placed for reading the table #
# Close connection #
$sth->finish;
my $finish=$dbh->disconnect;
Until here it works perfectly, now the script submits data through a form, I'll read it out and update the tables:
Code:
# Open mySQL connection #
$dbh = DBI->connect($DSN,$user,$pw);
# First SQL -> This doesn't update the database #
my $queryroster = "UPDATE roster SET pilotnr='$inputpilotnr', name='$inputname', hours='$inputhours', rank='$inputrank', award='$inputaward', comments='$inputcomments' WHERE pilotnr='$inputpilotnr'";
my $sth = $dbh->prepare($queryroster);
$sth->execute;
$sth->finish;
# Second SQL -> This does update the table #
my $queryuserinfo = "UPDATE userinfo SET pilotnr='$inputpilotnr', name='$inputname', email='$inputemail', icq='$inputicq', country='$inputcountry', fs='$inputfs', ivao='$inputivao', vatsim='$inputvatsim' WHERE pilotnr='$inputpilotnr'";
my $sth = $dbh->prepare($queryuserinfo);
$sth->execute;
$sth->finish;
# Third SQL -> This also updates the table #
my $queryassignments = "UPDATE assignments SET pilotnr='$inputpilotnr', name='$inputname', icao='$assicao', des='$assdes', flightnr='$assfnr', comments='$inputcomments', lastflight='$date' WHERE pilotnr='$inputpilotnr'";
my $sth = $dbh->prepare($queryassignments);
$sth->execute;
$sth->finish;
# Close the SQL connection #
my $finish=$dbh->disconnect;
So the first table isn't updated with the data, all the other tables are. I can't find the error, do you find it?