Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将搜索栏的结果发布到表中?PHP代码_Php_Mysql - Fatal编程技术网

如何将搜索栏的结果发布到表中?PHP代码

如何将搜索栏的结果发布到表中?PHP代码,php,mysql,Php,Mysql,情境:首先我将在搜索栏中输入word,然后结果将如何显示在表格上? 请帮帮我。我的论文真的需要它 require('connection.php'); if (isset($_POST['submit'])) { $param1=$_POST['search']; $checker = true; if(Empty($_POST['search']) || $_POST['search']==" ")

情境:首先我将在搜索栏中输入word,然后结果将如何显示在表格上? 请帮帮我。我的论文真的需要它

 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)) 
                    {
                       ?????
                    }
            }
    }
?>

Unrelated,但protip:停止使用mysql系列函数。改用mysqli。见:可能重复的
<?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;
            }
        }
    }
?>