Hallo to all,
I am trying to access my MySQL database using the following PERL script:

use DBI;
use CGI qw(:standard);

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

print "<HTML>\n<HEAD>\n<BODY>\n</HEAD>";

1       $host = "xxx.xxx.xxx.xxx";
2       $database = "my_db_name";
3       $user = "my_user_name";
4       $password = "my_db_passwd";

5       $dbh = DBI -> connect ("DBI:mysql:host= $host; database = $database", 
$user,password);

6       $sth = $dbh -> prepare ("select name, wins, losses from teams");

7       $sth -> execute();

8              while (@val = $sth -> fetchrow_array ()) {
9                     print p (sprintf ("name = $s, wins = $d, losses = $d\n",  
$val[0], $val[1], $val[2]));
10                    ++$count; }

11      $sth -> finish();
12      $dbh -> disconnect;

print "</P></FONT></BODY>\n</HTML>";


all I get from this is a white web page , the word "done" at page-foot. I 
suspect that connection has never occoured, also because I tryed to modify 
the parameters making them totally wrong, aspecting an error message telling 
me a "kick-off bloody foreigner!"
Same applies if I put a comment char # at lines 8,9,10
Could anyone help me? I am only a beginner and I realyze that books do not say 
everything...., the script has been copied from a book about MySQL and Perl.

Thank you

-- 
*******************
renzo rizzato
rovigo - italy
linux mandrake 10.0
linux user #272783
*******************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to