Chaotic Jarod has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use CGI qw(standard); use DBI(); use DBD::mysql; use warnings; use diagnostics; my $q = CGI->new; my $name = $q->param('name'); my $dbh = DBI->connect('dbi:mysql:oncall','webuser','password') or die "Connection Error: $DBI::errstr\n"; my $sth = $dbh->prepare('Select * from users where name = "$name"' +); $sth->execute(); print $q->header; print $q->start_html; print "<HTML>\n<HEAD>\n<TITLE>Users scheduled</title>\n</head>\n<B +ody bgcolor=white\n"; print "<h1>Users Schedules</h1>\n"; print "<Table border= 3>\n"; print "<TR><TH> Name</TH>><TH>On-Call</TH>><TH>Phone Number</th>\n +"; my ($name, $day, $phone) = $sth->fetchrow_array(); print "<tr><td>$name</td><td>$day</td><td>$phone</td>\n"; print "</table></body></html>\n"; $sth->finish(); $dbh->disconnect(); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Returning values from mysql with cgi
by davido (Cardinal) on Jul 18, 2013 at 05:35 UTC | |
by Chaotic Jarod (Novice) on Jul 18, 2013 at 13:26 UTC | |
|
Re: Returning values from mysql with cgi
by poj (Abbot) on Jul 18, 2013 at 06:03 UTC | |
|
Re: Returning values from mysql with cgi
by Anonymous Monk on Jul 18, 2013 at 00:37 UTC |