mdeepthi.89 has asked for the wisdom of the Perl Monks concerning the following question:
I'm getting an internal server error 500.I dont understand y i cant connect to the database.please help me#!/usr/bin/perl use DBI; use strict; use warnings; # Database settings my $database = "website"; my $username = "test"; my $password = 'testtest'; my $table = "apartments"; # Connect to database my $dbh = DBI->connect("dbi:mysql:database=$database;host=localhost;us +er=$username;password=$password") or die "Couldn't connect to databas +e: $DBI::errstr\n"; my $sth = $dbh->prepare("select * from $table')") or die "Couldn't pre +pare statement: $dbh->errstr\n"; $sth->execute() or die "Couldn't execute query 'sql': $DBI::errstr\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: unable to connect to mysql database
by wfsp (Abbot) on Jun 30, 2011 at 07:10 UTC | |
Re: unable to connect to mysql database
by wind (Priest) on Jun 29, 2011 at 22:30 UTC | |
Re: unable to connect to mysql database
by Anonymous Monk on Jun 30, 2011 at 04:15 UTC | |
Re: unable to connect to mysql database
by Anonymous Monk on Jun 30, 2011 at 03:39 UTC |