doukang7858 2017-03-13 06:07 采纳率: 0%
浏览 34

如何使用php将mysql数据库中的所有表显示或显示到html表中

I have a PHP script that creates tables with 3 rows in the admin's database(users).

$sql1="CREATE TABLE '".$username."' (id int(5) AUTO_INCREMENT, ip VARCHAR(255), password VARCHAR(255), PRIMARY KEY (id))";

So I want to have all the tables (it's rows and data) in the users database displayed on admin's dashboard like this:

<h3>Table_Name</h3>
<tr>
<th>Row1</th><th>Row2</th><th>Row3</th>
</tr>
<tr>
<td>All Data On Row1</td><td>All Data On Row2</td><td>All Data On Row3</td>
</tr>

Please someone should help me with a tested php mysql query on this issue. I sincerely don't have an idea on how to make this work. My xamp isn't helping matters because it can't seem to connect with the database, so i find it difficult testing my code; so help me with a tested and working code.

  • 写回答

2条回答 默认 最新

  • dongsi5381 2017-03-13 06:45
    关注
    1. First select a database.
    2. to get all tables of the database, run this query show TABLES;
    3. To get all column names of a table run this query DESCRIBE your_table_name;
    评论

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路