How to display output of perl on a webpage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ruchi choudhary
    New Member
    • Nov 2012
    • 22

    How to display output of perl on a webpage

    Actually I am creating a database by the help of perl and mysql, part of retrieving has been done through perl but now I can't understand how to display it's output on a webpage.So can anyone tell me how to do this?

    code is:
    Code:
    # PERL MODULES WE WILL BE USING
    use DBI;
    use DBD::mysql;
    
    
    # CONFIG VARIABLES
    $platform = "mysql";
    $database = "purchase";
    $port = "3306";
    $host = "localhost";
    $user = "root";
    $pw = "";
    
    #DATA SOURCE NAME
    $dsn = "dbi:mysql:$database:localhost:3306";
    
    
    # PERL DBI CONNECT
    $DBIconnect = DBI->connect($dsn, $user, $pw)or die "unable to connect:$DBI::errstr\n";
    
    #PREPARE THE QUERY
    $query = "SELECT * FROM naipone WHERE Fileno = '4-56/2008-09/AG(S)'";
    $query_handle = $DBIconnect->prepare($query);
    
    #EXECUTE THE QUERY
    $query_handle->execute();
    
    #BIND TABLE COLUMNS TO VARIABLES
    $query_handle->bind_columns(\$Sanctionamt, \$Availableamt, \$Dateoffirstrelease, \$Amtoffirstrelease, \$Dateofsecondrelease, \$Amtofsecondrelease, \$Netamt, \$Fileno, \$fileinitiation, \$nameofindenter, \$materialreceivedpurchasedandpaymentreleased, \$nameoffirm, \$completeaddressoffirm, \$head, \$subhead, \$sanctioneddate, \$sanctionedamt, \$progressivebal, \$sanctionedbal, \$billdate, \$billamt, \$billbal);
    
    
    #LOOP THROUGH RESULTS
    while($query_handle->fetch())
    {
    print"$Sanctionamt,$Availableamt,$Dateoffirstrelease,$Amtoffirstrelease,$Dateofsecondrelease,$Amtofsecondrelease,$Netamt,$Fileno,$fileinitiation,$nameofindenter,$materialreceivedpurchasedandpaymentreleased,$nameoffirm,$completeaddressoffirm,$head,$subhead,$sanctioneddate,$sanctionedamt,$progressivebal,$sanctionedbal,$billdate,$billamt,$billbal <br>";
    }
    Last edited by Meetee; Feb 11 '13, 06:24 AM. Reason: use code tags [/CODE] around code
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Do you have a web server?

    If so, is it setup correctly to execute scripts and is the script in the proper location (as specified in the web server config) and does it have the correct permissions?

    Once you verify those requirements and possibly a couple others, your script will need to output the proper content-type header prior to any other output.



    Comment

    Working...