APM: Dumb program acting funny...

CaptNemo CaptNemo at Austin.rr.com
Wed Oct 18 15:56:21 PDT 2006


Okay, instead of just returning the first 3 records, I modified it to print 
the whole line of records but now it acts up....
My database is 36 records wide and when I run it, I get:

[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
[Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value in 
concatenation (.) or string at ./dbquery.pl line 34.
VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID 
DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,VALID DATA,

Etc.

Why am I getting
         [Wed Oct 18 18:52:56 2006] dbquery.pl: Use of uninitialized value 
in concatenation (.) or string at ./dbquery.pl line 34.
                 ... and then correct data!?!?!



HERE's the Proggy
--------------------------------------------------
#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use DBI;
use strict;


my $dbdriver = $ARGV[0];
my $db = $ARGV[1];
my $dbuser = $ARGV[2];
my $dbpasswd = $ARGV[3];
my $dbtable = $ARGV[4];
my $condition = $ARGV[5];

my @row_array;
my $row;


if ( $#ARGV ==5 )
         {

                 my $dbh = DBI->connect( 
"DBI:$dbdriver:$db",$dbuser,$dbpasswd,)
                         || die "Database connection not made: $DBI::errstr";


                 my $sth = $dbh->prepare("SELECT * FROM $dbtable WHERE 
$condition")
                         or die $dbh->errstr;
                 $sth->execute() or die $dbh->errstr;

                 while (@row_array = $sth->fetchrow_array)
                         {
                                 foreach $row (@row_array)
                                 {
                                         print "$row,";  # <------ THIS IS 
LINE 34
                                 }
                                 print "\n";
                         }
                 $dbh->disconnect();
         }
         elsif ( $#ARGV <= 4 ) {
                 print 
"\n-----------------------------ERROR------------------------------\n";
                 print "NOT ENOUGH ARGUMENTS\n";
                 print "dbquery.pl usage: dbquery.pl DBDRIVER DB DBUSER 
DBPASSWORD DBTABLE \"CONDITION\"\n";
                 print "NOTE: DBDIVER is usually \"mysql\" but it can be 
other things like \"oracle\".\n";
                 print "      EXAMPLE: dbquery.pl mysql databas...\n";
                 print "NOTE: The total CONDITION must be in quotes with 
the matching data in single quotes. \n";
                 print "      EXAMPLE: \"product LIKE 'bicycle'\"\n";
                 print "---------------------------END 
ERROR----------------------------\n\n";
         }
                 else {
                 print 
"\n-----------------------------ERROR------------------------------\n";
                 print "TOO MANY ARGUMENTS\n";
                 print "dbquery.pl usage: dbquery.pl DBDRIVER DB DBUSER 
DBPASSWORD DBTABLE \"CONDITION\"\n";
                 print "NOTE: DBDIVER is usually \"mysql\" but it can be 
other things like \"oracle\".\n";
                 print "      EXAMPLE: dbquery.pl mysql databas...\n";
                 print "NOTE: The total CONDITION must be in quotes with 
the matching data in single quotes. \n";
                 print "      EXAMPLE: \"product LIKE 'bicycle'\"\n";
                 print "---------------------------END 
ERROR----------------------------\n\n";
         } 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/austin/attachments/20061018/bc17ce4f/attachment.html 


More information about the Austin mailing list