Guest User

Untitled

a guest
Jul 1st, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.88 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use DBI;
  4. use CGI;
  5. use Try::Tiny;
  6.  
  7. my $db = "magnian1_ncls2";
  8. my $username = "xxx";
  9. my $password = "yyy";
  10.  
  11. my $q = CGI->new;
  12.  
  13. print $q->header, $q->start_html('Test: '); try {
  14.  
  15. my $dsn = "DBI:mysql:database=$db;host=localhost;";
  16.  
  17. my $dbh = DBI->connect($dsn, $username, $password, {RaiseError => 1} );
  18.  
  19. my $sth = $dbh->prepare(q{ SELECT count(*) FROM nucleus_plugin_profile WHERE field = ? && value = ?;
  20.   });
  21.  
  22.  
  23.              $sth->execute("membership",2);
  24.  my $count = $sth->fetchrow_array();
  25.  
  26.     $sth = $dbh->prepare(q{
  27.     SELECT memberid,field,value FROM nucleus_plugin_profile WHERE value = ? && field = ?;
  28.   });
  29.  
  30.   $sth->execute("membership",2);  
  31.  
  32. my @ary;
  33.  
  34. print "There are ", $count, " Charge Points\n";
  35.  
  36. while ( @ary = $sth->fetchrow_array() ) {
  37.            print, @ary;
  38.  
  39.  
  40. } catch { print "Error: $_" }; print $q->end_html
Add Comment
Please, Sign In to add comment