• 查询数据库中所有表名


    查询数据库中所有表名
    select table_name from information_schema.tables where table_schema='csdb' and table_type='base table';


    查询指定数据库中指定表的所有字段名column_name
    select column_name from information_schema.columns where table_schema='csdb' and table_name='users'

    php获取:

    $server = 'localhost';
    $user = 'root';
    $pass = '';
    $dbname = 'dayanmei_com';
    $conn = mysql_connect($server,$user,$pass);
    if(!$conn) die("数据库系统连接失败!");
    mysql_select_db($dbname) or die("数据库连接失败!");
    $result = mysql_query("SHOW TABLES");
    while($row = mysql_fetch_array($result))
    {
    echo $row[0]."";
    }
    mysql_free_result($result);

  • 相关阅读:
    正则表达式
    抽象
    面向对象
    this关键字
    http协议
    URL
    Ajax
    PHP命名空间
    PDO
    异常
  • 原文地址:https://www.cnblogs.com/q1104460935/p/6907241.html
Copyright © 2020-2023  润新知