VC has asked for the wisdom of the Perl Monks concerning the following question:
I want to update all Disabled in mysql table, but I am only being Abel to update just one? HELP
$username = DB::trim (param ("Username")); $password = DB::trim (param ("Password")); $dbh = DB::connect(); $sth = $dbh->prepare ("SELECT * FROM EmployerJobs WHERE Username = + ? AND Password = ?"); $sth->execute($username, $password); while (my $row = $sth->fetchrow_hashref ()) { $ID = $row->{ID}; if ($userid eq $row->{USERID}) { $DISABLE = $row->{Disabled}; if (param("Disabled") eq "Yes") { $DISABLE = "Yes"; param (-name => "Disabled", -value => $DISABLE); param (-name => "ID", -value => $ID); $tbl_info = DB::TableInfo->get ($dbh, "EmployerJobs"); $tbl_info->update_record ($dbh, "ID"); }elsif (param("Disabled") eq "No") { $DISABLE = "No"; param (-name => "Disabled", -value => $DISABLE); param (-name => "ID", -value => $ID); $tbl_info = DB::TableInfo->get ($dbh, "EmployerJobs"); $tbl_info->update_record ($dbh, "ID"); }else { param (-name => "Disabled", -value => "No"); param (-name => "ID", -value => $ID); $tbl_info = DB::TableInfo->get ($dbh, "EmployerJobs"); $tbl_info->update_record ($dbh, "ID"); } } } $sth->finish (); $dbh->disconnect ();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: mysql update table how to
by hippo (Archbishop) on Mar 17, 2019 at 12:30 UTC | |
by VC (Novice) on Mar 18, 2019 at 19:33 UTC | |
Re: mysql update table how to
by poj (Abbot) on Mar 17, 2019 at 13:57 UTC | |
Re: mysql update table how to
by VC (Novice) on Mar 19, 2019 at 00:54 UTC | |
by huck (Prior) on Mar 19, 2019 at 02:42 UTC | |
by VC (Novice) on Mar 19, 2019 at 16:29 UTC | |
by hippo (Archbishop) on Mar 19, 2019 at 16:32 UTC | |
by VC (Novice) on Mar 19, 2019 at 16:02 UTC | |
by VC (Novice) on Mar 19, 2019 at 16:04 UTC | |
by VC (Novice) on Mar 19, 2019 at 19:31 UTC | |
by choroba (Cardinal) on Mar 19, 2019 at 19:51 UTC | |
by huck (Prior) on Mar 19, 2019 at 19:52 UTC | |
|