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

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

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

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...

Recommended Answers

All 2 Replies

Try like this

                    SQL => "SELECT count(ticket_id) FROM ticket_issue WHERE ticket_id = $TickID"


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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.