almost correct

Discussion in 'Perl Misc' started by Nikos, May 12, 2005.

  1. Nikos

    Nikos Guest

    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 :)
    Nikos, May 12, 2005
    #1
    1. Advertising

  2. Nikos

    Nikos Guest

    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?
    Nikos, May 12, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James McGivney

    DataGrid - almost have it

    James McGivney, Nov 20, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    342
    Jacob Yang [MSFT]
    Nov 22, 2003
  2. joon
    Replies:
    1
    Views:
    515
    Roedy Green
    Jul 8, 2003
  3. Dan

    correct or not correct?

    Dan, Oct 2, 2003, in forum: HTML
    Replies:
    7
    Views:
    443
  4. J.Ram
    Replies:
    7
    Views:
    653
  5. froil
    Replies:
    12
    Views:
    310
    Gunnar Hjalmarsson
    Mar 2, 2006
Loading...

Share This Page