in reply to Re: DBD and a MySQL query with a SET @num line
in thread DBD and a MySQL query with a SET @num line
#!/usr/bin/env perl use strict; use warnings; use DBI; use Data::Dumper; # MYSQL CONFIG VARIABLES my $host = "localhost"; my $db = "XYZ"; my $dbuser = "XYZ"; my $dbpw = "XYZ"; # CONNECT TO MYSQL my $dbh = DBI->connect("DBI:mysql:$db", $dbuser, $dbpw) || die "Could +not connect to database: $DBI::errstr"; my $file = "../sql/code.sql"; my $myquery; { local $/ = undef; open FILE, $file or die "Couldn't open file: $!"; $myquery = <FILE>; close FILE; } my $sth = $dbh->prepare($myquery); $sth->execute(); my $tbl_ary_ref = $sth->fetchall_arrayref; my $nrows = scalar @{ $tbl_ary_ref };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: DBD and a MySQL query with a SET @num line
by karlgoethebier (Abbot) on Jan 19, 2014 at 16:52 UTC |