我想知道是否有人可以请求帮助
我有以下代码在SQL数据库中搜索结果。
即使我输入了这个人的全名,我也没有收到一些名字。如果我在其中放入一个他们名字的信件?
<form class="form-horizontal" action="" method="POST" enctype="multipart/form-data">
<input type="text" class="form-control1" id="keyword" name="keyword" value="" >
<input class="btn-success btn" type="submit" name="search" id="search" value="Submit" onclick="this.value='Sending, please wait...'">
</form>
<<?php
if(isset($_POST['search']) && !empty($_POST) ){
$keyword = trim ($_REQUEST['keyword']);
echo "Keyword: ".$keyword;
$servername = "localhost";
$username = "user_name";
$password = "*********";
$dbname = "user_db";
// Account Manager
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM work_staff WHERE staff_first LIKE '%".$keyword."%' OR staff_surname LIKE '%".$keyword."%'";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_assoc($result)) {
echo "Found: ".$row['staff_first']." ".$row['staff_surname'] ;
echo " ";
echo "<br>";
echo "<br>";
}
mysqli_close($conn);
}
?>
我真的很沮丧。任何人可以提供的帮助都会很棒。
由于
罗布