从sql回显php中的数组元素无法正常工作

时间:2017-11-15 15:14:51

标签: php

我尝试从数据库回显,但我没有得到任何结果

而sql查询从phpmyadmin完美运行。

我不知道这里有什么问题。

这是我的代码

           <?php
            $result = mysqli_query($con, "SELECT * FROM exam INNER JOIN user ON 
            exam.department_id = user.department_id
            WHERE   user.login_id like 'I%%' And exam.display_exam = 'yes' 
            ORDER BY exam_id ASC") or die(mysqli_error($con));
            $row= mysqli_num_rows($result);

            if(mysqli_num_rows($result)>0){
            echo "there are rows";

            while($row = mysqli_fetch_array($result)){

            ?>

            <tr>
                <td class="line"> <?php echo $row['c_code']; ?> </td>
                <td class="line"> <?php echo date('m-d-Y', 
                 strtotime($row['exam_from'])) . ' - ' . date('m-d-Y', 
                 strtotime($row['exam_to'])); ?> </td>
                <td class="line"> <?php echo $row['exam_type'];?></td>
                <td class="line"> <?php echo $row['time_limit'] + 'minute(s)';?></td>
                <td class="line"> <?php echo $row['passing_score'];?></td>
                <td width="100" align="center" class="line1">
                    <a href="javascript:loadPage('index.php?
                 staff/examsresult&exam_id=<?php echo $row['exam_id'] ?>');"> View Result</a>
                </td>
            </tr>
            <?php
        }
    }  

0 个答案:

没有答案