<?php$keywords = isset($_GET['keywords']) ? trim($_GET['keywords']) : '';$conn = @mysql_connect('localhost','root','admin')or die('数据库连接失败');mysql_query('use phpvideo');mysql_query('set names utf8');$sql = "SELECT * FROM t_one WHERE username LIKE '%{$keywords}%'";$rs = mysql_query($sql);$users = array();if(!empty($keywords)){ while($row = mysql_fetch_assoc($rs)){ $users[]= $row; }} print_r($users);?><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>ee</title></head><body><h1>22</h1><form action="" method="POST">xx:<input type="text" name="keywords" value="" /><input type="submit" value="tjbd" /></form><?phpecho '<h3>查询关键字 <font color="red">'.$keywords.'</font>的结果</h3>'; if($users){ echo '<table width="500" border="1" cellpadding="5"'; echo '<tr><th>用户></th></tr>'; //这里有个FOR循环我就不写了,写了也没用 echo '</table>'; }else{ echo '没有用户'; }?>
1 回答
- 1 回答
- 0 关注
- 1981 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消