I have two folders php
and perl
. They contain index.php
and index.pl
, respectively.
My Perl code looks like:
#!/usr/bin/perl
use Mysql;
print "Content-type: text/html\n\n";
print "<h2>PERL-mySQL Connect</h2>";
print "page info";
$host = "localhost";
$database = "cdcol";
$user = "root";
$password = "";
$db = Mysql->connect($host, $database, $user, $password);
$db->selectdb($database);
When i run above code (by typing http://localhost:88/perl/
in the browser), I get the following error:
Can't locate Mysql.pm in @INC (@INC contains: C:/xampp/perl/site/lib/ C:/xampp/perl/lib C:/xampp/perl/site/lib C:/xampp/apache) at C:/xampp/htdocs/perl/index.pl line 2. BEGIN failed--compilation aborted at C:/xampp/htdocs/perl/index.pl line 2.
whereas browsing to http://localhost:88/php/
works.
index.php
has:
<?php
$con = mysql_connect("localhost","root","");
if($con)
{
if(mysql_select_db("cdcol", $con))
{
$sql="SELECT Id From products";
if(mysql_query($sql))
{
$result = mysql_query($sql);
if ($result) ...