我知道我可以添加这个:
<form>
Search Google:
<input type="search" name="googlesearch">
</form>
但这只会让我搜索谷歌。
我希望人们能够搜索这个列表上的名字。http://graphicambi.tk/onlineemployees.html
我该怎么做?
也是
我不知道该放在哪里也
这是我代码的一部分:
}
$sql = "SELECT userID, users_name, usertype, status FROM tbluseraccounts";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
if($row["status"] == "Online"){
$tcolor = "green";
}
elseif($row["status"] == "Offline"){
$tcolor = "red";
}
echo "<br>ID: " . $row["userID"]. " <br> Name: " . $row["users_name"]. " <br> Account Type: " . $row["usertype"]. " <br> Status: <font color='".$tcolor."'>" . $row["status"]. "</font><br>";
}
} else {
echo "0 results";
}
哪里说:
echo "<br>ID: " . $row["userID"]. " <br> Name: " . $row["users_name"]. " <br> Account Type: " . $row["usertype"]. " <br> Status: <font color='".$tcolor."'>" . $row["status"]. "</font><br>";
我想在那里创建边界,这样当你访问这个网站时http://graphicambi.tk/onlineemployees.html每个账户名称周围都会有一个黑色边框
谢谢。
我认为您的订单在数据库中,因此您可以使用简单的搜索表单。
类似这样的东西:
<FORM method="POST" action="search.php">
<INPUT type="text" name="search">
<INPUT type="submit">
</FORM>
在您的search.php文件中:
$sql = "SELECT userID, users_name, usertype, status FROM tbluseraccounts WHERE users_name LIKE %$_POST['search']%";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
if($row["status"] == "Online"){
$tcolor = "green";
}
elseif($row["status"] == "Offline"){
$tcolor = "red";
}
echo "<br>ID: " . $row["userID"]. " <br> Name: " . $row["users_name"]. " <br> Account Type: " . $row["usertype"]. " <br> Status: <font color='".$tcolor."'>" . $row["status"]. "</font><br>";
}
} else {
echo "0 results";
}