How to query with multiple conditions in PHP search box? ?
逆向行走
逆向行走 2019-06-20 16:48:02
0
3
1906

I am new to PHP. When writing the content of the search box, I found that I cannot query multiple conditions at the same time. Could anyone please give me some ideas on how to write it? I am grateful for 搜索框.png


# This is the pHP content written below:

& LT *) as total from tb_file where f_type=1"; //Find published content

                                $sql = mysqli_query($conn,$inquire);

                       $result = mysqli_fetch_assoc($sql ; #                                                                                            <td colspan="8" class="text-center">No query content yet, please search again</td>

                                                                                                                                                                                                                                                                             Pagination class

                                                                                                                                                                                                                 ! How to query multiple conditions at the same time

                                    $inquireCon = "select * from tb_file where f_qualitynum like '%$fileNum%' or f_filename like '%$fileName%' or f_department='$department' or f_classify='$qualityfile' order by f_date desc limit ".$page->limit()."";



                                    $sqlCon = mysqli_query($conn, $inquireCon);

                                    while($resultCon = mysqli_fetch_assoc($sqlCon)){

                                       ?>

                                       <tr>

                                           <td class="text-center" style="vertical-align: middle;"><input type="checkbox" name=""></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_qualitynum']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_filename']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_classify']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_grade']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_department']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><?php echo $resultCon['f_date']; ?></td>

                                           <td class="text-center" style="vertical-align: middle;"><input type="text" name="download" class="btn btn-default btn-xs" style="width: 50%;" value="下载" style="width: 80%;"></td>

                                        </tr>

                                       <?php

                                    }

                                 }

                              ?>


逆向行走
逆向行走

reply all(3)
!
if (strlen($SO['cate_id'])) {
    $filter[] = [
        'cate_label', 'like', "%," . trim($SO['cate_id']) . ",%"
    ];
}
if (strlen($SO['audit'])) {
    $filter[] = [
        'audit', '=', $SO['audit']
    ];
}
if ($SO['title']) {
    $filter[] = [
        'title', 'like', "%" . trim($SO['title']) . "%"
    ];
}

Let’s see if something like this works. This is how tp is written. For native, use splicing. I haven’t written native for a long time.

逆旅行人

According to the data obtained, if it is not empty, the splicing conditions will be fine.

逆向行走

Upvote it, if you know anything, I hope you can help me. grateful

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template