所以为了更好地解释我在做什么,
所以我需要将while语句更改为if语句。关于如何编写它只是有点模糊,以便它只发布匹配我的查询的每一列。
$con=mysqli_connect("$host", "$username", "$password","$db_name");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM table");
while($info = mysqli_fetch_array($result))
{
echo " | ".$info['site']. " | " .$info['asset']. " | " .$info['hostname']. " | " .$info['sys_name']. " | ". $info['ip']. " | ";
echo "<br>";
}
答案 0 :(得分:0)
SQL中的通配符是%
。当VANCOOVER写成%VANCOOVER%
时,VANCOOVER之前或之后的所有内容都会被忽略。在PHP中,LIKE %$Search%
SELECT * FROM table WHERE site LIKE '%VANCOOVER%'