如何在搜索表中的任何数据后获取所有数据表

时间:2015-11-02 06:06:38

标签: php mysql date select

我正在处理一件事情,我展示了表格并在其上放置了一个搜索过滤器。但是在这个系统中,当我按日期搜索时,我得到了正确但然后我必须返回并再次来到所有数据表的那个页面。那么如何在搜索单个数据后显示我的所有表格内容。

        <?php

        if (!isset($_SESSION['userid'])) {

                ?><div class="message">
                    To access this page, you must be logged.<br />
                    <a href="connexion.php">Log in</a>
                </div><?php
            }
            else{

                //Video count values of the database
                if(isset($_REQUEST['date1'])){
                    $req = mysqli_query($conn, 'SELECT video_master.id, user_master.username, user_master.rec_id, user_master.f_name, video_master.video_count, video_master.is_redim, video_master.video_date FROM video_master INNER JOIN user_master ON video_master.rec_id=user_master.rec_id where  user_master.rec_id="'.$_SESSION['userid'].'" AND video_master.video_date = "' . $_REQUEST['date1'] . '"');

                    // var_dump($req);
                }

                  else{

                        //We get the IDs, usernames and emails of users
                        $req = mysqli_query($conn, 'SELECT video_master.id, user_master.username, user_master.rec_id, user_master.f_name, video_master.video_count, video_master.is_redim, video_master.video_date FROM video_master INNER JOIN user_master ON video_master.rec_id=user_master.rec_id');

                }

    if(mysqli_num_rows($req)>0)
                {

                while($dnn = mysqli_fetch_array($req))
                {
            ?>
                    <tbody><tr>
                        <td class="left"><?php echo $dnn['id']; ?></td>
                        <td class="left"><?php echo $dnn['rec_id']; ?></td>
                        <!-- <td class="left"><?php //echo htmlentities($dnn['id'], ENT_QUOTES, 'UTF-8'); ?></td> -->
                        <td class="left"><?php echo htmlentities($dnn['username'], ENT_QUOTES, 'UTF-8'); ?></td>
                        <td class="left"><?php echo htmlentities($dnn['f_name'], ENT_QUOTES, 'UTF-8'); ?></td>
                        <td class="left"><?php echo htmlentities($dnn['video_count'], ENT_QUOTES, 'UTF-8'); ?></td>
                        <td class="left"><?php 

                         if($dnn['video_count'] < 250)
                                {
                                    $amount1 = $dnn['video_count']*0;
                                    echo $amount1;            
                                } 
                                    else
                                        {
                                            if($dnn['video_count'] <= 500)
                                            {
                                                $amount1 = $dnn['video_count']*0.25;
                                                echo $amount1;            
                                            } else
                                                {
                                                    if($dnn['video_count'] <= 750)
                                                    {
                                                        $amount1 = $dnn['video_count']*0.50;
                                                        echo $amount1;            
                                                    } else
                                                        {
                                                            if($dnn['video_count'] <= 1000)
                                                            {
                                                                $amount1 = $dnn['video_count']*0.75;
                                                                echo $amount1;            
                                                            } else
                                                                {
                                                                    if($dnn['video_count'] <= 1250)
                                                                    {
                                                                        $amount1 = $dnn['video_count']*1;
                                                                        echo $amount1;            
                                                                    } else
                                                                        {    
                                                                            if($dnn['video_count'] < 1500)
                                                                            {
                                                                                $amount1 = $dnn['video_count']*1.50;
                                                                                echo $amount1; 
                                                                            } else
                                                                                {

                                                                                }
                                                                        }
                                                                }
                                                        }                      
                                                } 
                                        } 
                                        ?></td>


                        <td class="left"><?php echo htmlentities($dnn['is_redim'], ENT_QUOTES, 'UTF-8'); ?></td>
                        <td class="left"><?php echo htmlentities($dnn['video_date'], ENT_QUOTES, 'UTF-8'); ?></td>


            <?php
                 }
             }
             }
            ?>

我从日期开始创建了搜索。

1 个答案:

答案 0 :(得分:1)

点击按钮并重新加载页面。这不是正确的方法,但它可以解决您的问题。