Dynamic table in HTML using MySQL and php

前端 未结 2 895
挽巷
挽巷 2021-01-23 15:32

I\'ve seen many posts about how to build a table in HTML with PHP and Mysql, but my problem is, that I often change the headers of MySQL columns. Is there any way that PHP autom

2条回答
  •  無奈伤痛
    2021-01-23 15:58

    I just read your question, and coded to meet your needs, but I used PDO and not MYSQLI, maybe it is better for you to understand the code, because with PDO everything is simpler. And the way I did it, you don't need to put all the tags, PHP will update automatically, and know that the file must end with the extension .php!

    
    
    
    
    
        
        
        Document
        
    
    
        prepare($sql);
            $result->execute();
    
            if($result->rowCount() > 0):
                $rows = $result->fetchAll();
                foreach($rows as $row):
            ?>
            
    ID FirstName LastName Birthday

提交回复
热议问题