N
Nikos
ok before we go into the step i asked i must somehow load the games
database table with a row coantaining 3 fields. The games name, the
games description and the number of times the games downloaded by the user.
I had the table loaded with repetitive insert into statements but now
the games folder has more than 100+ games so i need a more automatic way
of filling it in.
I have made the following snippet of code but as usual it aint working
as it should so i could use a liitle Monk help/suggestions. After
completeing this part i will go to the one i first asked because now
that i deleted the insert into statements i must firstly load the
database table again Any way here is the code so far:
It would be even better that the description of the game would not be
the same text as the name of the game that why i have wriiten all the
description in one file in the same folder as games separating by one
line but i donw know hot to load them as a 2nd parameter to the 2nd ? in
prepare. Any way here is the code so far:
$db->do( "create table games( name varchar, desc text, counter int"
+);
#=====================================================================
+==========
my $st = $db->prepare( "INSERT INTO games VALUES (?, ?, ?)" );
my @games = glob( "/data/games/*" ) or die $!;
print @games;
while (@games) {
$st->execute( $_, $_, 0 );
}
#=====================================================================
+==========
# hre is the part that load the description game into an array from a
+file containign the descs
open(FILE, "</data/games/descriptions.txt") or die $!;
my @desc = <FILE>;
close(FILE);
@desc = grep { !/^\s*\z/s } @desc;
database table with a row coantaining 3 fields. The games name, the
games description and the number of times the games downloaded by the user.
I had the table loaded with repetitive insert into statements but now
the games folder has more than 100+ games so i need a more automatic way
of filling it in.
I have made the following snippet of code but as usual it aint working
as it should so i could use a liitle Monk help/suggestions. After
completeing this part i will go to the one i first asked because now
that i deleted the insert into statements i must firstly load the
database table again Any way here is the code so far:
It would be even better that the description of the game would not be
the same text as the name of the game that why i have wriiten all the
description in one file in the same folder as games separating by one
line but i donw know hot to load them as a 2nd parameter to the 2nd ? in
prepare. Any way here is the code so far:
$db->do( "create table games( name varchar, desc text, counter int"
+);
#=====================================================================
+==========
my $st = $db->prepare( "INSERT INTO games VALUES (?, ?, ?)" );
my @games = glob( "/data/games/*" ) or die $!;
print @games;
while (@games) {
$st->execute( $_, $_, 0 );
}
#=====================================================================
+==========
# hre is the part that load the description game into an array from a
+file containign the descs
open(FILE, "</data/games/descriptions.txt") or die $!;
my @desc = <FILE>;
close(FILE);
@desc = grep { !/^\s*\z/s } @desc;