1 $dbname=DB_NAME; 2 $host=DB_HOST; 3 $port=DB_PORT; 4 $user =DB_USER; 5 $password=DB_PWD; 6 7 $mysqli = new \mysqli($host, $user, $password, $dbname,$port); 8 $mysqli->set_charset("utf8"); 9 $sql=trim($_POST["sql_content"]);10 $result = $mysqli->query($sql);11 12 13 $data=array();14 $data["check_sql"]=$sql;15 $data["result_str"]="";16 $data["total_str"]="";17 18 if($mysqli->errno>0){19 $data["result_str"]="更新失败";20 $data["total_str"]="".$mysqli->error."";21 }else{22 if(is_object($result)){23 $data["result_str"].="
$key | ";33 }34 $content_str.="$value | ";35 }36 37 if(!empty($header_str)){38 $data["result_str"].= "
共计 ".$mysqli->affected_rows."行 ".$colums."列
";46 $result->close();47 }else{48 $data["result_str"]="更新成功";49 $data["total_str"]=" 共计 ".$mysqli->affected_rows."行
";50 }51 }52 $mysqli->close();