View Single Post
  #10  
Old 08-28-2015, 02:49 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

I apologize:
Code:
use DBI;
use DBD::mysql;
sub List {
    my $idfile = shift;
    chomp $idfile;
    my $user = "USERNAME";
    my $pass = "PASSWORD";
    my $db = "DATABASE";
    my $dbh = DBI->connect("dbi:mysql:$db:localhost:3306", $user, $pass);
    $sth = $dbh->prepare("SELECT DISTINCT icon FROM `items` WHERE `idfile` = '$idfile' ORDER BY `icon` ASC");
    $sth->execute();
    my @a;
    if ($sth->rows() > 0) {
        while (my $icon = $sth->fetchrow()) {
            push @a, $icon;
        }
    }
    $sth->finish();
    $dbh->disconnect();
    return "All of the following item icons are used for idfile $idfile: " . join(", ", @a);
}
print "What idfile would you like to see the icons for?\n";
my $idfile = <STDIN>;
print List($idfile);
Example of use:
Reply With Quote