#!/usr/bin/perl

use CGI;
use DBI;
use Data::Password qw(:all);


my $self = 'updateMssid.pl';

eval require "../etc/admin.conf";
if ( $@ ) {
    print $lex{Error}. ": $@<br>\n";
    die $lex{Error}. ": $@\n";
}


my $q = new CGI;
print $q->header( -charset, $charset ); 
my %arr = $q->Vars;


my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);



# Select table to Edit.
my $table;
if ( not $arr{tb} ) { # no passed table to edit...
    $table = 'student';
}

if ( $arr{tb} eq 'wd' ){ # if passed a tb=wd param, then edit wd table.
    $table = 'studentwd';
} 

my $title = qq{Update MSSID};
print qq{$doctype\n<html><head><title>$title</title>\n};
print qq{<link rel="stylesheet" href="$css" type="text/css">\n};
print qq{$chartype\n</head><body style="padding:1em;">\n};
print qq{<h1>$title</h1>\n};


#my $id = $arr{id};

my $sth = $dbh->prepare("update $table set mssid = ? where studid = ?");
#$sth->execute( $arr{mssid}, $id );
if ( $DBI::errstr ) { print $DBI::errstr; }
    
print qq{</body></html>\n};


