mysqli_fetch_数组不知道join select语句mysql php的返回值

mysqli_fetch_数组不知道join select语句mysql php的返回值,php,mysql,Php,Mysql,我正在数据库系统上工作,我需要从数据库返回值,并将它们以表格形式输出,我在尝试运行网页时使用join语句,它会出现以下错误消息: 注意:未定义索引:student.name in 这是我的部分代码 if (isset($_POST['submit_exam'])){ $gerayesh_id=mysqli_real_escape_string($cnn,$_POST['gerayesh_id']); $exam_number=mysqli_real_esca

我正在数据库系统上工作,我需要从数据库返回值,并将它们以表格形式输出,我在尝试运行网页时使用join语句,它会出现以下错误消息:

注意:未定义索引:student.name in

这是我的部分代码

   if (isset($_POST['submit_exam'])){
        $gerayesh_id=mysqli_real_escape_string($cnn,$_POST['gerayesh_id']);
        $exam_number=mysqli_real_escape_string($cnn,$_POST['exam_number']);
        $query="SELECT student.name , student.lname , student.student_id , exam.exam_number , exam.exam_id FROM";
        $query.=" exam  JOIN exam_register  on exam.exam_id=exam_register.exam_id";
        $query.=" JOIN student  on student.student_id=exam_register.student_id";
        $query.=" WHERE (exam.gerayesh_id=$gerayesh_id)";
        $query.=" AND (exam.exam_number=$exam_number)";
        $result=mysqli_query($cnn,$query);
        if($result){
        echo "<form method=\"post\" action=\"manage_add_result.php\"  target=\"_blank\" style=\"float:right;\">";
    echo "<table >";
        echo    "<tr>";
                echo "<th>&#1606;&#1575;&#1605;</th>";
                echo "<th>&#1606;&#1575;&#1605; &#1582;&#1608;&#1575;&#1606;&#1608;&#1575;&#1583;&#1711;&#1740;</th>";
                echo"<th>&#1588;&#1605;&#1575;&#1585;&#1607; &#1570;&#1586;&#1605;&#1608;&#1606;</th>";
                echo "<th>&#1575;&#1606;&#1578;&#1582;&#1575;&#1576;</th>";


            echo"</tr>";
    while($row=mysqli_fetch_array($result) ){

            echo"<tr>";
            echo"<td>{$row['student.name']}</td>";
            echo "<td>{$row['student.lname']}</td>";
            echo "<td>{$row['exam.exam_number']}</td>";
            echo "<td><input type=\"checkbox\" value=\" {$row['student.student_id']}\" name=\"student_id\"/></td>";
            echo "<input type=hidden name=exam_id value=\"{$row['exam.exam_id']}\">";


            echo"</tr>";        

     }
    // $row=mysqli_fetch_array($result);

     echo"</table>";
         echo "<input type=\"submit\" name=\"submit_student\" value=\"&#1570;&#1662;&#1604;&#1608;&#1583; &#1705;&#1575;&#1585;&#1606;&#1575;&#1605;&#1607;;\">";
     echo "</form>";



        } else{echo mysqli_error($cnn);}


    }
错误未定义索引显示了我所有应该在表中显示的变量 我在想我能做什么
感谢您的时间

关联数组中的键只是列名,而不是table.column。因此,请使用:


如果从具有相同名称的不同表返回列,则需要为它们指定别名,以便能够引用这两个列。这不是查询的问题,SELECT子句中的所有列名都不同。

使用mysqli时,应该使用参数化查询,并将用户数据添加到查询中。不要使用手动转义和字符串插值来完成此操作,因为您将创建严重错误。结果是,键上的数据将作为列的名称,而不是查询中的表名,如“$row['name']”,student是表名,在select语句中引用,以从students表['name']中选择名称列['student.name']等。
        echo"<td>{$row['name']}</td>";
        echo "<td>{$row['lname']}</td>";
        echo "<td>{$row['exam_number']}</td>";
        echo "<td><input type=\"checkbox\" value=\" {$row['student_id']}\" name=\"student_id\"/></td>";
        echo "<input type=hidden name=exam_id value=\"{$row['exam_id']}\">";