UPDATE table
Posted: Fri Aug 11, 2006 9:43 pm
well i know the syntax to update a table would be like so:
in a different script i created an INSERT query, but it is fairly large, and i really dont feel like changing all syntax, is there any way i can just change a few things in my current query and change it so it updates rather than insert?
Code: Select all
mysql_query("UPDATE ".$dbtable."SET player_name = '$player_name'.......... WHERE pid= '$pid'");Code: Select all
$sql = mysql_query("INSERT INTO ".$dbtable." VALUES ('$pid', '$player_name', '$player_rank', '$pcid', '$total_team_games_played', '$total_time_palyed', '$total_kills', '$team_win_percentage', '$deaths', '$killed_2_for_1', '$login_count', '$medical_saves', '$minutes_played', '$psp_takeover_attempts', '$psp_takeovers', '$saved_by_medics', '$team_draws', '$team_experience_points', '$team_losses', '$team_wins', '$total_head_shots', '$assault_rifle_uses', '$assault_rifle_hits', '$assault_rifle_kills', '$assault_rifle_headshots', '$assault_rifle_accuracy', '$claymore_uses', '$claymore_hits', '$claymore_kills', '$claymore_headshots', '$claymore_accuracy', '$emplaced_weapons_uses', '$emplaced_weapons_hits', '$emplaced_weapons_kills', '$emplaced_weapons_headshots', '$emplaced_weapons_accuracy', '$grenades_uses', '$grenades_hits', '$grenades_kills', '$grenades_headshots', '$grenades_accuracy', '$knife_uses', '$knife_hits', '$knife_kills', '$knife_headshots', '$knife_accuracy', '$machine_gun_uses', '$machine_gun_hits', '$machine_gun_kills', '$machine_gun_headshots', '$machine_gun_accuracy', '$missiles_uses', '$missiles_hits', '$missiles_kills', '$missiles_headshots', '$missiles_accuracy', '$pistol_uses', '$pistol_hits', '$pistol_kills', '$pistol_headshots', '$pistol_accuracy', '$satchel_uses', '$satchel_hits', '$satchel_kills', '$satchel_headshots', '$satchel_accuracy', '$shotgun_uses', '$shotgun_hits', '$shotgun_kills', '$shotgun_headshots', '$shotgun_accuracy', '$sniper_rifle_uses', '$sniper_rifle_hits', '$sniper_rifle_kills', '$sniper_rifle_headshots', '$sniper_rifle_accuracy', '$submachine_gun_uses', '$submachine_gun_hits', '$submachine_gun_kills', '$submachine_gun_headshots', '$submachine_gun_accuracy', '$dm_levels', '$dm_deaths', '$dm_doubles', '$dm_medsaves', '$dm_minplayed', '$dm_experiencepoints', '$dm_headshots', '$dm_totalkills', '$koth_levels', '$koth_deaths', '$koth_doubles', '$koth_medicalsaves', '$koth_zonetime', '$koth_minutesplayed', '$koth_experiencepoints', '$koth_headshots' , '$koth_totalkills', '$flag_levels', '$flag_captured', '$flag_saved', '$flag_deaths', '$flag_doubles', '$flag_medsaves', '$flag_minutesplayed', '$flag_experiencepoints', '$flag_headshots', '$flag_totalkills', '$bw_levels', '$bw_targets', '$bw_deaths', '$bw_doubles', '$bw_medicalsaves', '$bw_minutesplayed', '$bw_experiencepoints', '$bw_headshots', '$bw_kills', '$kill_death_ratio', '$win_loss_ratio', '$head_shot_ratio', '$total_levels', '$kpm', '$dpm', '$average_exp')") or die("Error: ".mysql_error());