- Code: Select all
#!/usr/bin/perl
use Mysql;
#use strict;
print "Content-type: text/html \n\n";
#prevent Perl from creating undeclared variables
#not used
#my($host, $database, $tablename, $user, $pw, $connect, $db, $table);
#my(@tables);
# MYSQL CONFIG VARIABLES
$host = "localhost";
$database = "reg_perl";
$tablename = "tblcontacts";
$user = "username";
$pw = "password";
# PERL MYSQL CONNECT()
$connect = Mysql->connect($host, $database, $user, $pw);
# SELECT DB
$connect->selectdb($database);
# LISTTABLES()
@tables = $db->listtables;
# PRINT EACH TABLE NAME
@tables = $connect->listtables;
foreach $table (@tables) {
print "$table<br />";
}
despite that i get this error when running it
- Code: Select all
Can't locate Mysql.pm in @INC (@INC contains: /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0//darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/ /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/5.10.0 /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0/darwin-2level /Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0 . /Applications/XAMPP/xamppfiles) at /Applications/XAMPP/xamppfiles/htdocs/perl/perl_reg_sql/registration.pl line 5. BEGIN failed--compilation aborted at /Applications/XAMPP/xamppfiles/htdocs/perl/perl_reg_sql/registration.pl line 5. ,
this line here though is close, its just in /DBD, is there any fix for this? I dont know where to even start
- Code: Select all
/Applications/XAMPP/xamppfiles/lib/perl5/site_perl/5.10.0//darwin-2level
Any help would be appreciated thanks