almost correct

N

Nikos

With this way since is more straighforward and less lines of code: Now
the code is like this:

#=======================LOADING THE .TXT TO THE DATABASE==============
+==========

my $replace = $dbh->prepare( "REPLACE INTO games (gamename, gamedesc,
+gamecounter) VALUES (?, ?, ?)" );

open (FILE, "<../data/games/descriptions.txt") or die $!;

while (<FILE>) {
chomp;

if (length) {
$replace->execute( split(/\t/, $_, 2), 0 ) or print $dbh->errs
+tr;
}
}

close (FILE);

But the records never get updated and if i delete a row on the txt file
but the insertion of a new row or an edit of an existing one work ok :)
 
N

Nikos

In the top of my games.pl script i have

my $gamename = param('gamename');

and

print start_form(-action=>'games.pl');
print table( {class=>'games'} );
while( $row = $sth->fetchrow_hashref )
{
print Tr(
td( {-width=>'20%'}, submit( $row->{gamename} )),
td( {-width=>'75%'}, $row->{gamedesc} ),
td( {-width=>'5%'}, $row->{gamecounter} )
);
}
print end_table;
print end_form;

This is where the submit button is created and this is where i check if
the user click on a game

if( param('gamename') )

but it never returns true! Do you think there is a confilct with the
gamesnname as i have it in the submit button and expect the user to
click on the desired game to download by passign it as a parameter to
the script?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top