spermer_co Posted April 2, 2011 Report Share Posted April 2, 2011 Sveiki. Variet luudzu kads palabot sho mysql kveriju. Probleema taaada, ka tas nevis atjauno jau esoshos datus, kur niks = $niks, bet gan izveido velvienu taadu rindu. Kapec tas taa ir? $result = mysql_query("UPDATE `db_cup_players` SET `points` = '".$points."', `x1x1played4` = '".$x1x1played4."', `x1x1played8` = '".$x1x1played8."', `meleeplayed6` = '".$meleeplayed6."', `meleeplayed8` = '".$meleeplayed8."', `totalplayed` = '".$totalplayed."', `x1x1final4` = '".$x1x1final4."', `x1x1final8` = '".$x1x1final8."', `meleefinal6` = '".$meleefinal6."', `meleefinal8` = '".$meleefinal8."', `totalfinal` = '".$totalfinal."', `x1x1win4` = '".$x1x1win4."', `x1x1win8` = '".$x1x1win8."', `meleewin6` = '".$meleewin6."', `meleewin8` = '".$meleewin8."', `totalwin` = '".$totalwin."', `firstcup` = '".$firstcup."', `lastcup` = '".$lastcup."' WHERE niks = '".$niks."'"); if (mysql_affected_rows() == 0) { // No records updated, so add it $result = mysql_query("INSERT INTO `db_cup_players` (niks, points, x1x1played4, x1x1played8, meleeplayed6, meleeplayed8, totalplayed, x1x1final4, x1x1final8, meleefinal6, meleefinal8, totalfinal, x1x1win4, x1x1win8, meleewin6, meleewin8, totalwin, firstcup, lastcup) VALUES ('".$niks."', '".$points."', '".$x1x1played4."', '".$x1x1played8."', '".$meleeplayed6."', '".$meleeplayed8."', '".$totalplayed."', '".$x1x1final4."', '".$x1x1final8."', '".$meleefinal6."', '".$meleefinal8."', '".$totalfinal."', '".$x1x1win4."', '".$x1x1win8."', '".$meleewin6."', '".$meleewin8."', '".$totalwin."', '".$firstcup."', '".$lastcup."')"); } echo Done; Paldies. Quote Link to comment Share on other sites More sharing options...
m8t Posted April 2, 2011 Report Share Posted April 2, 2011 Pārtulko vārdu "insert". Quote Link to comment Share on other sites More sharing options...
wintermute Posted April 2, 2011 Report Share Posted April 2, 2011 http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html 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.