加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
dt.php 7.51 KB
一键复制 编辑 原始数据 按行查看 历史
@HuangBingGui 提交于 2021-07-02 07:35 . -
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "cp";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
}
if(!isset($_GET["b_qi"])){
$_GET["b_qi"]=0;
}
if(!isset($_GET["f"])){
$_GET["f"]="";
}
$sql =
"select hao ,w ,min(qi) ,max(qi) ,count(*) "
." from"
." (select * from cp order by qi desc limit ".$_GET["b_qi"].",".$_GET["qi"].") as t"
." group by w "
." having count(*)>=".$_GET["count"]
." order by max(qi) desc";
$result = $conn->query($sql);
if(isset($_GET["b_qi"])){
$top1=$_GET["b_qi"]-1;
}else{
$top1=0;
}
$sql_top1="select hao ,w ,min(qi) ,max(qi) ,count(*) "
." from"
." (select * from cp order by qi desc limit ".$top1.",".$_GET["qi"].") as t"
." group by w "
." order by max(qi) desc";
//." #having count(*)>=".$_GET["count"]
if($top1>=0){
$result_top1 = $conn->query($sql_top1);
}
$sql_top100="select * from cp order by qi desc limit ".($top1+1).",".$_GET["qi"];
$result_top100 = $conn->query($sql_top100);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>大数据人工智能策略预测</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
padding:2px;
}
.jumbotron {
padding: 4px 10px 4px 10px;
}
</style>
</head>
<body>
<h3 style="text-align: center;display:<?php echo $_GET['f']; ?>">大数据人工智能策略预测</h3>
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<form class="navbar-form navbar-left" role="search">
<div class="input-group">
<span class="input-group-addon">周期</span>
<input type="text" name="qi" class="form-control" placeholder="推荐100近周期数;" value="<?php echo $_GET['qi']; ?>">
</div>
<div class="input-group">
<span class="input-group-addon">上几期</span>
<input type="text" name="b_qi" class="form-control" placeholder="推荐0开始期;" value="<?php echo $_GET['b_qi']; ?>">
</div>
<div class="input-group" style="display:<?php echo $_GET['f']; ?>">
<span class="input-group-addon">剔除次数</span>
<input type="text" name="count" class="form-control" placeholder="推荐2剔除次数;" value="<?php echo $_GET['count']; ?>">
</div>
<button type="submit" class="btn btn-default">预测</button>
<input type="text" name="f" style="display:none" class="form-control" value="<?php echo $_GET['f']; ?>">
</form>
</div>
</nav>
<?php
$dr="";
$gr="";
for($i=0;$i<100;$i++){
if($i<=9){
$gr=$gr."0".$i."xx、";
}else{
$gr=$gr.$i."xx、";
}
if($i%10==0 && $i!=0){
$gr=$gr."<br>";
}
}
if ($result->num_rows > 0) {
$i=0;
while($row = $result->fetch_assoc()) {
$i=$i+1;
$dr=$dr.$row["w"]."xx"."、";
if($i%10==0){
$dr=$dr."<br>";
}
$gr=str_replace($row["w"]."xx、","",$gr);
}
} else {
echo "0 结果";
}
$gr=str_replace("<br>","",$gr);
$dr=str_replace("<br>","",$dr);
?>
<div class="jumbotron">
<h4>报告(高)(推荐):<?php echo (100-$result->num_rows)/100; ?></h4>
<h4>剔除次数<?php echo $_GET['count']; ?></h4>
<?php echo $gr; ?>
</div>
<div class="jumbotron">
<h4>报告(专业):</h4>
<h4>剔除次数<?php echo $_GET['count']; ?></h4>
<?php
if($top1>=0){
if ($result_top1->num_rows > 0){
$row_top1 = $result_top1->fetch_assoc();
$row_now_w=$row_top1["w"]."xx、";
if($_GET["count"]>=$row_top1["count(*)"]){
$win="肉!";
$win_color="red";
}else{
$win="素!";
$win_color="green";
}
echo "<h4 class=''>"
//color:".$win_color.";font-size: 20px;
."<span style='color:".$win_color."'>".$win."-</span>"
."<span>" . $row_top1["hao"]."-</span>"
. "<span>" . $row_top1["w"]."xxx"."-</span>"
. "<span>" .$row_top1["min(qi)"] ."-</span>"
."<span>" .$row_top1["max(qi)"]."-</span>"
."<span style='display:". $_GET['f']."'>" .$row_top1["count(*)"]."</span>"
."</h4><br>";
}else{
echo "<tr class=''><td>没有开奖!</td></tr><br>";
$row_top1["w"]="00";
$win="没有!";
}
}
else{
echo "<tr class=''><td>没有开奖!</td></tr><br>";
$row_top1["w"]="00";
$win="没有!";
}
$i=0;
echo "<tr class=''><td colspan='6'>(推荐)近20期:";
$gr20=$gr;
$gr_top1=$gr;
$row_top1_data="";
while($row_top100 = $result_top100->fetch_assoc()) {
$i=$i+1;
if($row_top1 && $i==1){
$row_top1_data=$row_top100["w"];
}
echo $row_top100["w"]."xx-"."、";
$gr20=str_replace($row_top100["w"]."xx、","",$gr20);
$gr20=str_replace("<br>","",$gr20);
if($i==20){
break;
}
}
echo "<br>剔除结果:<div>".$gr20."</div>";
if($win=="肉!"){
if(stripos($gr20, $row_now_w)>-1){
echo "剔除"."<span style='color:red'>"."肉!</span><br>";
}else{
echo "剔除"."<span style='color:green'>"."素!</span><br>";
}
}
echo "</td></tr>";
echo "<br><tr class=''><td colspan='6'>(可选)上期前1-2位:";
echo substr($row_top1_data,0,1)."-".substr($row_top1_data,1,1);
$gr_top1=str_replace("、".substr($row_top1_data,0,1),"、剔除",$gr_top1);
$gr_top1=str_replace(substr($row_top1_data,1,1)."xx、","剔除xx、",$gr_top1);
echo "<br>剔除结果:<div>".$gr_top1."</div>";
if($win=="肉!"){
if(stripos($gr_top1, $row_now_w)>-1){
echo "剔除"."<span style='color:red'>"."肉!</span><br>";
}else{
echo "剔除"."<span style='color:green'>"."素!</span><br>";
}
}
echo "</td></tr>";
echo "<br><tr class=''><td colspan='6'>(可选)上期前1-2位,再剔除前20期:";
echo substr($row_top1_data,0,1)."-".substr($row_top1_data,1,1);
$gr20=str_replace("、".substr($row_top1_data,0,1),"、剔除",$gr20);
$gr20=str_replace(substr($row_top1_data,1,1)."xx、","剔除xx、",$gr20);
echo "<br>剔除结果:<div>".$gr20."</div>";
if($win=="肉!"){
if(stripos($gr20, $row_now_w)>-1){
echo "剔除"."<span style='color:red'>"."肉!</span><br>";
}else{
echo "剔除"."<span style='color:green'>"."素!</span><br>";
}
}
echo "</td></tr>";
?>
</div>
<div class="jumbotron">
<h4>报告(低):<?php echo $result->num_rows/100; ?><br><?php echo $dr; ?></h4>
</div>
<div class="jumbotron">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>行号</th>
<th>5位数</th>
<th>前2位</th>
<th>最早期</th>
<th>最近期</th>
<th style="display:<?php echo $_GET['f']; ?>">次数</th>
</tr>
</thead>
<tbody>
<?php
$result = $conn->query($sql);
if(!isset($_GET["id"])){
$_GET['f']="";
}
if ($result->num_rows > 0) {
$i=0;
while($row = $result->fetch_assoc()) {
$i=$i+1;
echo "<tr class=''>"
."<td>" . $i."</td>"
."<td>" . $row["hao"]."</td>"
. "<td>" . $row["w"]."xxx"."</td>"
. "<td>" .$row["min(qi)"] ."</td>"
."<td>" .$row["max(qi)"]."</td>"
."<td style='display:". $_GET['f']."'>" .$row["count(*)"]."</td>"
."</tr>";
}
} else {
echo "0 结果";
}
$conn->close();
?>
</tbody>
</table>
</div>
<div class="jumbotron">
<div>1、Ctrl+C复制到excel;</div>
<div>2、截屏保存!</div>
</div>
</body>
</html>;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化