Thanks Adam but actually i have quit tryign to do it with my way and i decided to do it with your way since it 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 :-)

Also after this code i ahve this:
if( param() ) { $dbh->do( "UPDATE games SET gamecounter=gamecounter+1 WHERE gamena +me='$gamename'" ); $dbh->do( "UPDATE guestlog SET passage='$gamename' WHERE host='$ho +st'" ); $sth = $dbh->prepare( "SELECT * FROM games WHERE gamename=?" ); $sth->execute( $gamename ); $row = $sth->fetchrow_hashref; print span( {class=>'lime'}, "Είσαι ο $row->{gamecounter} ος πο +υ κατεβάζει το $row->{gamename} !!" ), br; print span( {class=>'yellow'}, "Ελπίζω να σου αρέσει και να σου φ +ανεί χρήσιμο!" ); print p( {-align=>'center'}, a( {href=>'index.pl'}, img {src=>'. +./data/images/back.gif'} )); print "<script language='Javascript'>location.href=/data/games/$ga +mename.rar</script>"; } which is supposed to print a message when a user hits a game button to + be download and show the user what he choosed to downlaoded and how +many time it was in general downloaded but it doesnt.

In reply to Re^4: Updating or Inserting a database from a txt file by Nik
in thread Updating or Inserting a database from a txt file by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.