How I can execute many queries in one page?

前端 未结 2 375
忘了有多久
忘了有多久 2021-01-29 14:00

I write this code but when I run it no output. There is no error but the problem no output.

How I can execute many queries in the same page?


&         


        
2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 14:20

    First: there is an error. You are missing a where in the first query:

    $query = "SELECT * FROM `student_record` id = 201102887;";
    

    has to be:

    $query = "SELECT * FROM `student_record` where id = 201102887;";
    

    That is sufficient to have a blank screen.

    For the rest your code is ok, in line with the classical example from:

    http://php.net/manual/en/mysqli.multi-query.php

    What I wonder is if you really configured your server to execute php inside html.

    Put this part of your code with the above correction in a .php file and you will see results:

    
    

    I added the missing where and the closure of the connection.

    By the way, I hope you are sure the records with those ids exist in your DB.

提交回复
热议问题