Array callback has to contain indices 0 and 1 in C:\xampp\htdocs\crud\update.php:15 Stack trace: #0 {main} code example

Example: Array callback has to contain indices 0 and 1 in C:\xampp\htdocs\crud\update.php:15 Stack trace: #0 {main}

<form class="post-form" action="<?php $_SERVER['PHP_SELF'];?>"  method="post">
        <div class="form-group">
            <label>Id</label>
            <input type="text" name="sid" />
        </div>
        <input class="submit" type="submit" name="showbtn" value="Show" />
    </form>

    <?php 
        if(isset($_POST['showbtn'])){
            $conn=mysqli_connect("localhost","root","","student"); //student is Database name
            $student_id=$_POST['sid']; 	//=>By this syntax, the error will be solved
            $sql="SELECT *from student where sid={$student_id}";
            $result=mysqli_query($conn,$sql) or die("Query Unsuccessful");
    ?>

Tags:

Php Example