为了账号安全,请及时绑定邮箱和手机立即绑定

问一下我的用户查询的PHP代码哪里有错,echo里的$keywords不显示出来

问一下我的用户查询的PHP代码哪里有错,echo里的$keywords不显示出来

嘘声 2014-12-15 21:25:43
<?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 关注
  • 1958 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信