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

<?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>


<?php


echo '<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 '没有用户';

}


?>


嘘声
浏览 1982回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP