即时尝试更新字段,所以当我在localhost上它会成功完成所有事情,但是当我在服务器上它什么都不做。这是代码:
if(isset($_POST['update'])){
$update_data = array(
'total_kills' => $total_kills,
'total_deaths' => $total_deaths,
'total_assists' => $total_assists,
'highest_champ_dmg' => $highest_champ_dmg,
'times_played' => $times_played,
'wins' => $wins,
'losses' => $losses,
'win_rate' => $win_rate,
'record_total_dmg' => $record_total_dmg,
'total_kda' => $total_kda,
'average_kills' => $average_kills,
'average_deaths' => $average_deaths,
'average_assists' => $average_assists,
'average_kda' => $average_kda,
'highest_kills' => $highest_kills,
'highest_deaths' => $highest_deaths,
'highest_assists' => $highest_assists,
'highest_kda' => $highest_kda,
'lowest_kills' => $lowest_kills,
'lowest_deaths' => $lowest_deaths,
'lowest_assists' => $lowest_assists,
'lowest_kda' => $lowest_kda
);
foreach($update_data as $field=>$data){
$update = '`' . $field .'` = \'' . $data . '\'';
$dbc->query("UPDATE `champions` SET ".implode(', ',array($update)) ."WHERE `name`='$champ_name'");
}
}
if(!$_SESSION['Username'] == ""){
echo '<input type="submit" value="Update" name="update">';
}
是否有我应该知道的东西会影响托管时的代码?
答案 0 :(得分:0)
像这样更新行:
$update = '`' . $field .'` = '\' . $data . '\'';