spermer_co Posted August 21, 2010 Report Share Posted August 21, 2010 (edited) Taatad, problemina taada, ka mans kverijs nevis atjauno jau esoshus lietotaja datus, bet gan velreiz pievieno identisku ierakstu datubaazee, tapeec ludzu palidziet man atrisinat sho problemu. Tada sajuta ka vins neatpazist to ka "niks" ailiitee esoshie dati ir tadi pashi kaa $niks $result = mysql_query("UPDATE `db_players` SET points='".$points."', x1x1played4='".$x1x1played4."'' WHERE niks='".$niks."'"); if (mysql_affected_rows() == 0) { $result = mysql_query("INSERT INTO db_cup_players (niks, points, x1x1played4) VALUES ('".$niks."', '".$points."', '".$x1x1played4."')"); } Edited August 21, 2010 by spermer_co Quote Link to comment Share on other sites More sharing options...
mickys Posted August 21, 2010 Report Share Posted August 21, 2010 Return Values Returns the number of affected rows on success, and -1 if the last query failed. Varbūt kverijā kļūda? konkrētāk šī vieta x1x1played4='".$x1x1played4."'' divas pēdiņs beigās? Quote Link to comment Share on other sites More sharing options...
Val Posted August 21, 2010 Report Share Posted August 21, 2010 (edited) abos vaicājumos tabulu nosaukumi arī atšķiras. jēga taisīt 2 dažādas tabulas ar vienu un to pašu info? Edited August 21, 2010 by Val Quote Link to comment Share on other sites More sharing options...
codez Posted August 21, 2010 Report Share Posted August 21, 2010 INSERT ... ON DUPLICATE KEY UPDATE Quote Link to comment Share on other sites More sharing options...
Kverkagambo Posted August 23, 2010 Report Share Posted August 23, 2010 mysql_affected_rows() atgriež 0 arī, ja vecie rindas dati sakrīt ar jaunajiem. Vari izmantot mysql_info(), un no tā izņemt "Rows matched:". Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.