View Single Post
  #6  
Old 08-27-2015, 09:53 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,603
Default

Double posting because it's a bump:
Code:
use DBI;
use DBD::mysql;
sub List {
    my $icon = shift;
    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 idfile FROM `items` WHERE `icon` = '$icon' ORDER BY `idfile` ASC");
    $sth->execute();
    my @a;
    if ($sth->rows() > 0) {
        while (my $idfile = $sth->fetchrow()) {
            push @a, $idfile;
        }
    }
    $sth->finish();
    $dbh->disconnect();
    return "All of the following item textures are used for icon $icon: " . join(", ", @a);
}
print "What icon would you like to see the textures for?\n";
my $icon = int(<STDIN>);
print List($icon);

Last edited by Kingly_Krab; 08-28-2015 at 02:50 PM..
Reply With Quote