From 4f262a03e418b7ffd2c2a10f7d2aad01522a43d7 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 21 Apr 2018 16:18:07 +0900 Subject: [PATCH] =?UTF-8?q?command=5FSingle=20=EB=8F=99=EC=9E=91=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_command.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/hwe/func_command.php b/hwe/func_command.php index 89c09e4c..f9e96d55 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -681,19 +681,21 @@ where nation='{$general['nation']}' function command_Single($turn, $command) { + if(!$turn){ + header('location:commandlist.php'); + return; + } + $db = DB::db(); - $connect=$db->get(); $userID = Session::getUserID(); $command = EncodeCommand(0, 0, 0, $command); - $count = count($turn); - $str = "con=con"; - for($i=0; $i < $count; $i++) { - $str .= ",turn{$turn[$i]}='{$command}'"; + $setValues = []; + foreach($turn as $turnIdx){ + $setValues["turn{$turnIdx}"] = $command; } - $query = "update general set {$str} where owner='{$userID}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('general', $setValues, 'owner=%i',$userID); header('location:commandlist.php'); }