Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.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_Css_Cookies - Fatal编程技术网

Php 不显示表格的函数

Php 不显示表格的函数,php,mysql,css,cookies,Php,Mysql,Css,Cookies,这是给我的错误和idk为什么,表存在,但仍然不工作,我做错了什么 内容确实显示了,但仍然给出了错误,并且没有显示它应该显示的内容 function content_temp() { if(isset($_GET['action'])) { if($_GET['action'] == 'banlist') { echo " <div class='positiontable'> <tabl

这是给我的错误和idk为什么,表存在,但仍然不工作,我做错了什么

内容确实显示了,但仍然给出了错误,并且没有显示它应该显示的内容

function content_temp()
{
    if(isset($_GET['action']))
    {
        if($_GET['action'] == 'banlist')
        {
            echo " <div class='positiontable'>
          <table class='MYTABLE'>
          <tr CLASS='MYTABLE'>
                    <th CLASS='MYTABLE' height=40 width=80>User</th>
                    <th CLASS='MYTABLE' height=40 width=80>Time</th>
                    <th CLASS='MYTABLE' height=40 width=180>Reason</th>
                    <th CLASS='MYTABLE' height=40 width=80>Admin</th>
                  </tr>
                  </table>
                  </div> ";

        $query ="SELECT * FROM `Banovi` LIMIT 5"; 
        $row = mysqli_fetch_array($query);
        if($row)
            $name = $row['Ime'];
            $time = $row['Vreme'];
            $reason = $row['Razlog'];
            $admin = $row['Admin'];
            echo " <tr CLASS='MYTABLE'>
                <td CLASS='MYTABLE' height=40 width=80>$name</td>
                <td CLASS='MYTABLE' height=40 width=80>$time</td>
                <td CLASS='MYTABLE' height=40 width=180>$reason</td>
                <td CLASS='MYTABLE' height=40 width=80>$admin</td>
              </tr>";           
        }
    }
}
函数内容_temp()
{
如果(isset($_GET['action']))
{
如果($_GET['action']=='banlist')
{
回声“
使用者
时间
理由
管理
";
$query=“从'Banovi`LIMIT 5'中选择*;
$row=mysqli\u fetch\u数组($query);
如果($行)
$name=$row['Ime'];
$time=$row['Vreme'];
$reason=$row['Razlog'];
$admin=$row['admin'];
回声“
$name
$time
美元原因
$admin
";           
}
}
}

更新2

您可能需要做一些更改:

function content_temp( $con ){
  if(isset($_GET['action'])){
    if($_GET['action'] == 'banlist'){
      echo " <div class='positiontable'>
        <table class='MYTABLE'>
          <thead>
            <tr CLASS='MYTABLE'>
              <th CLASS='MYTABLE' height=40 width=80>User</th>
              <th CLASS='MYTABLE' height=40 width=80>Time</th>
              <th CLASS='MYTABLE' height=40 width=180>Reason</th>
              <th CLASS='MYTABLE' height=40 width=80>Admin</th>
            </tr>
          </thead>
          <tbody>";
          $query ="SELECT * FROM `Banovi` LIMIT 5"; 
          $result = mysqli_query($con,$query);
          while( $row = mysqli_fetch_array($result,MYSQLI_ASSOC) ){

            $name = $row['Ime'];
            $time = $row['Vreme'];
            $reason = $row['Razlog'];
            $admin = $row['Admin'];
            echo "
              <tr CLASS='MYTABLE'>
                <td CLASS='MYTABLE' height=40 width=80>$name</td>
                <td CLASS='MYTABLE' height=40 width=80>$time</td>
                <td CLASS='MYTABLE' height=40 width=180>$reason</td>
                <td CLASS='MYTABLE' height=40 width=80>$admin</td>
              </tr>";
          }?>
        </tbody>
      </table><?php           
    }
  }
}

所以,在没有水晶球的情况下,您得到cuz wdk时出现了什么错误?Print_r$行,并且您从表中获取了5条记录,并且没有使用任何循环。为了引起大家的注意,该用户在2小时前提出了类似的问题。在Stack Overflow中,他总共问了7个问题,没有接受我们的任何回答。在这个问题中,他使用了
echo“
,这就是
echo”
。他从这个问题中得到了答案,并没有费心接受那个花时间和精力纠正错误并解决问题的用户的答案。是的,没问题,谢谢你让我明白:)娜娜,你也可以向我解释,不是马上开始争论,我只是注册到论坛上,我不能从一开始就知道一切;)我明白了,它说con没有定义,但是在脚本的顶部有
code
include(“database.php”);在这一点上,谢谢你,我不再收到任何错误,但它也不会在任何地方显示表格:谢谢你,没有错误!:)顺便说一句,我如何通过所有mysql字段进行循环并获取所有字段,因为它只获取第一个字段谢谢,你帮了我很多:)不客气。请考虑投票回答,表示感谢,而不是发表评论。
$con = mysqli_connect("localhost","my_user","my_password","my_database");
content_temp( $con );