php - Error in fetching array in prepared statements -


i'm getting error in fetching data table prepared statements. yes, i'm new in prepared statements. body got solution or i'm doing wrong?

<?php   session_start();   $student_rollno = $_session['student_roll'];   require('../includes/connect.php');   $stmnt = $conn->prepare("select students.roll, students.firstname, students.lastname, students.course, students.semester students,teachers students.roll = ? , students.semester = teachers.semester ");   $stmnt->bind_param('i',$student_rollno);  if ($stmnt->execute()){ $result = $stmnt->get_result(); while ($row = $result->fetch_array(mysqli_assoc)){     $student_roll = $row["0"];     $student_name = $row["1"];     $student_course = $row["2"];     $student_semester = $row["3"];      ?>         <h1>hello <?php echo $student_roll; ?>. details : </h1><br><br>         <h2>roll no : <?php echo $student_name ?></h2>         <h2>course : <?php echo $student_course ?></h2>         <h2>semester : <?php echo $student_semester ?></h2>  <?php  }}   $stmnt->close();  $conn->close(); ?> 

i got solution myself. giving me time btw!

the correct solution is:

        $student_roll = $row["roll"];         $student_name = $row["firstname"];         $student_course = $row["lastname"];         $student_semester = $row["course"]; 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -