in reply to DBD and a MySQL query with a SET @num line

G'day edieguez,

Please copy and paste your Perl code verbatim. When we see it, we may be able to help you.

You would probably also benefit from reading the guidelines in "How do I post a question effectively?".

-- Ken

  • Comment on Re: DBD and a MySQL query with a SET @num line

Replies are listed 'Best First'.
Re^2: DBD and a MySQL query with a SET @num line
by edieguez (Initiate) on Jan 19, 2014 at 16:09 UTC
    Hi Ken, Here is the Perl code:
    #!/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 };

      But what is in code.sql?

      Regards, Karl

      «The Crux of the Biscuit is the Apostrophe»