Loading ...
Sorry, an error occurred while loading the content.
 

[PBML] #exec

Expand Messages
  • Louis Fechter
    Hi Guys, I have a database with a perl query script. I have an HTML file which contains the following. the
    Message 1 of 3 , Oct 1, 2002
      Hi Guys,

      I have a database with a perl query script.

      I have an HTML file which contains the following.
      <!--#exec cgi="cgi-bin/prices.pl?code=000003" -->

      the perl scrip looks like this.

      #! c:/perl -w
      use CGI;
      use DBI;


      $input=new CGI;
      $code=$input->param('code'); #product code
      #---
      $dbh=DBI->connect('DBI:mysql:furniture') || die 'ERR: connect';

      $query="SELECT price FROM benches WHERE code=?";
      print "$code <--";
      print $query;
      $sth=$dbh->prepare($query);
      $sth->execute($code);
      #---
      print "hello";
      print $sth->dump_results;
      $dbh->disconnect;
      #---
      exit 0;

      the database has stock codes and also has prices linked to the stock
      codes. Im trying to get it to print the price from knowing the stock
      code... can anyone tell me what could be wrong with the perl script ?

      It was working in offline mode - IF I entered 000003 as the stock code -
      it returned the correct price. But when running it thru the HTML page
      with the #exec it returned "0 rows"

      Help would be much appreciated. Thanks :)

      Louis
    Your message has been successfully submitted and would be delivered to recipients shortly.