如何用php做一个温度显示系统,分享自己写的一个简单php脚本

[PHP] 纯文本查看 复制代码

收集的一些东西

$conn=mysqli_connect('127.0.0.1','root','');//数据库连接

mysqli_select_db($conn,"test");//选择数据库

$hash='select count(*) from artifact where type="hash"';

$tiquan='select count(*) from artifact where type="提权"';

$dict='select count(*) from artifact where type="字典"';

$inlan='select count(*) from artifact where type="内网"';

$web='select count(*) from artifact where type="web"';

$arr = array();

array_push($arr,$hash,$tiquan,$dict,$inlan,$web);//搜索语句放入数组

foreach ($arr as $key => $value) {

$query=mysqli_query($conn,$value);//执行sql语句

while($row = mysqli_fetch_array($query))

{

$re=preg_match('/type="(.*)"/',$value,$match);//匹配type

echo '

'.$match[1].'['.$row[0].']'.'';//打印输出

}

}

?>

简介用途种类

$str1='';

if(!isset($_GET['type']))

{

$str1='';

}

else{

$str1= " where type='".addslashes($_GET['type'])."'";

}

$conn=mysqli_connect('127.0.0.1','root','');//连接数据库

mysqli_select_db($conn,"test");//选择数据库

$query=mysqli_query($conn,'select * from artifact'.$str1) or die('Error happens');//执行sql语句

while($row = mysqli_fetch_array($query))//循环输出

{

echo '

';

echo '

'.$row['name'].''.$row['intro'].''.$row['type'].'';

echo '

';

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值