/ Published in: Perl

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
sub db_connect { my ($dbname, $dbuser, $dbpass) = @_; #$dbh->do(qq{set character set 'utf8';}); } sub do_sql { # Takes: $dbh, $sql # Returns: status } sub execute_sql { # Takes: $dbh, $sql # Returns: $result_arrayref my $sth = $dbh->prepare($sql); $sth->execute; my $result = $sth->fetchall_arrayref({}); # {} => Return arrayref of hashrefs } sub do_insert { #takes: $dbh, $table, $datahash #returns: status }
Comments
