0

hello,
I am new in perl..i am just trying to connect perl with mysql database.
for this i installed xampp server in my system..and now perl,apache and mysql are running on my system.
i also check server by running cgi program on it..
evrything is right.but i dont know why i cant connect perl tp nwsql..
i write the folowing code to connect with mysql
#!"C:\xampp\perl\bin\perl.exe"

print "Content-Type: text/html\n\n";


use DBI;
$dbh = DBI->connect('dbi:mysql:data','root');
;
$sql = "select * from tab1";
$sth = $dbh->prepare($sql);
$sth->execute;

while (@row = $sth->fetchrow_array) {
print "@row\n";
}

bt when i eun this program on server i get an error that """"Premature end of script headers: a.cgi """"

I did every thing bt i couldnt remove this error??
please help me if anybody knows about this..
thnks in advance...
--

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mitchems
0

Hi,
Try like this

$Self->{DBObject}->Prepare(
                    SQL => "SELECT count(ticket_id) FROM ticket_issue WHERE ticket_id = $TickID"
        );

Thanks,
Deepak

Edited by mike_2000_17: Fixed formatting

0

Do you have the DBD driver for MySQL installed? Also, can you run a script from teh command line that accesses the database? Can you run that specific cgi script from teh command line as the web server user?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.