Good afternoon,

Here is the output of my script, and can’t understand why this is not working.
Thanks for any and all pointers!
Dave Gilden

[EMAIL PROTECTED]:~/cgi-bin$  mail_guest_to_jk.cgi 
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 33.

Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 37.
DBD::mysql::st execute failed: You have an error in your SQL syntax near '' at line 1 
at ./mail_guest_to_jk.cgi line 60.
DBD::mysql::st fetchrow failed: fetch() without execute() at ./mail_guest_to_jk.cgi 
line 40.
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 41.
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 41.
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 41.
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 41.
Use of uninitialized value in concatenation (.) or string at ./mail_guest_to_jk.cgi 
line 41.



the script:
---------------------
#!/usr/bin/perl -w

use DBI;
use strict;

## Sensitive stuff deleted :)

my ($sql,$dbh,$sth,$datecreated,$name,$email,$comments);

&initialize_dbi;


#### Read from Guestbook ###################

### get id for last entry  
$sql ="SELECT MAX(id) FROM $table_name;";

run_statement($sql);

my $id = $sth->{id};
print "$id\n";

$sth->finish; 

$sql = "SELECT id, DATE_FORMAT(DATE_ADD(datecreated, INTERVAL 2 HOUR), '%c/%e/%y at: 
%l:%i %p'),email, name, comments FROM $table_name where id = $id;";

run_statement($sql);
# get the one row selected
($id,$datecreated,$email,$name,$comments) = $sth->fetchrow;
print "$id\n$datecreated\n$email\n$name\n$comments";
$dbh->disconnect; # close date base connection 
exit;


sub initialize_dbi{
   my $drh = DBI->install_driver( 'mysql' );
   $dbh = DBI->connect("DBI:mysql:$user_name:$sql_server", $user_name, $user_password);
   die "Cannot connect: $DBI::errstr\n" unless $ ;
}


sub run_statement{
    my $stmt = shift;
    $sth = $dbh->prepare($stmt);
    $sth->execute;
}

__END__




==============================================
         Cora Connection: Your West African Music Source
              Resources, Recordings, Instruments & More!
                   <http://www.coraconnection.com/> 
==============================================

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to