1.php代码
<?phpmysql_connect('127.0.0.1','root','wjy123') or die('exit(-1)');
mysql_select_db('floatbtn');
mysql_query('set names utf8');2.代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ppick u</title>
<style type="text/css">
.btn {
font-family: "微软雅黑";
font-size: 12px;
color: #FFF;
background-color: #369;
border: 1px solid #666;
}
.box {
font-family: "微软雅黑";
color: #369;
font-size: 12px;
border: 1px solid #369;
}
</style>
</head>
<body>
<a href='throwbtn.php'>发布信息</a>
<form id="form1" name="form1" method="post" action="pickbtn.php">
<table width="80%" border="0">
<?php@include('mysql.php');
if(isset($_REQUEST['new'])){
$q = 'SELECT * FROM `btn`';
$rs = mysql_query($q);
$max = mysql_num_rows($rs);
$rd = rand(1,$max);
$q = "select * from `btn` where id = {$rd}";
$rs = mysql_query($q);
while($re = mysql_fetch_array($rs)){
?>
<tr>
<td class="box" width="12%">ID : </td>
<td class="box" width="88%"><?=$re['author']?></td>
</tr>
<tr>
<td class="box" >Text : </td>
<td class="box"><?=$re['text'] ?></td>
</tr>
<tr>
<td class="box">Date : </td>
<td class="box"><?=$re['date']?></td>
</tr>
<p class="box">已读标记 <?=$re['flag']?></p>
</table>
<?php$q = "update `btn` set flag = 1 where id = {$re['id']}";
mysql_query($q);
}
}
?>
<input class="btn" name="new" type="submit" value="截取"/>
</form>
</body>
</html>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号