情况:首先我会在搜索栏中输入单词,然后结果如何在桌面上? 请帮我。我的论文真的需要它。
require('connection.php');
if (isset($_POST['submit']))
{
$param1=$_POST['search'];
$checker = true;
if(Empty($_POST['search']) || $_POST['search']==" ")
{
echo "Please Enter a Information";
$checker = false;
}
if($checker == true)
{
$result = mysql_query("SELECT * FROM user WHERE lastname LIKE %$param1% OR
firstname LIKE %$param1% OR middlename LIKE %$param1% OR IDno LIKE %$param1% OR username LIKE
%$param1% OR email LIKE %$param1% OR birthday LIKE %$param1% OR guardian LIKE %$param1% OR
gradelevel LIKE %$param1% OR section LIKE %$param1%;");
while ($row = mysql_fetch_assoc($result))
{
?????
}
}
}
?>
答案 0 :(得分:1)
<?php
require('connection.php');
if (isset($_POST['submit']))
{
$param1=$_POST['search'];
$checker = true;
if(Empty($_POST['search']) || $_POST['search']==" ")
{
echo "Please Enter a Information";
$checker = false;
}
if($checker == true)
{
$result = mysql_query
("
SELECT *
FROM user
WHERE lastname
LIKE %$param1%
OR firstname
LIKE %$param1%
OR middlename
LIKE %$param1%
OR IDno
LIKE %$param1%
OR username
LIKE
%$param1%
OR email
LIKE %$param1%
OR birthday
LIKE %$param1%
OR guardian
LIKE %$param1%
OR gradelevel
LIKE %$param1%
OR section
LIKE %$param1%
");
$fetch = array();
while ($row = mysql_fetch_assoc($result))
{
$fetch[] = $row;
}
}
}
?>