RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
php获取所有数据库名,php查询数据库数据

php如何获取数据库信息

代码如下:?View Code PHP include("conn.php");//调用数据库连接文件 echo "table width=572 height=56 border=0 cellspacing=1 "; //创建html表格 echo "tr bgcolor=#9999FF"; echo "th width=33 scope=colid/th"; echo "th width=100 scope=coluser_name/th "; echo "th width=100 scope=coluser_pass/th "; echo "th width=100 scope=colstaus/th"; echo "th width=100 scope=colinsert_time/th"; echo "/tr"; $SQL = "select * from user_info"; $query = mysql_query($SQL); //SQL查询语句 while ($row = mysql_fetch_array($query)){ //使用while循环mysql_fetch_array()并将数据返回数组 echo "tr onmouseout=this.style.backgroundColor='' onMouseOver=this.style.backgroundColor='#99CC33' bgcolor=#CCCCCC"; echo "td$row[0]/td"; //输出数组中数据 echo "td$row[1]/td"; echo "td$row[2]/td"; echo "td$row[3]/td"; echo "td$row[4]/td"; echo "/tr"; } echo "/table";输出记录截图

从事达州服务器托管,服务器租用,云主机,雅安服务器托管,空间域名,CDN,网络代维等服务。

phppdo连接的数据库怎么获取表名

$dbh是new PDO()

$dbh-exec("show tables");--获取所有表#

$dbh-exec("desc 表名");--查询表结构

如何用php获取数据库信息并显示

获取ppq数据库的所有表名的代码:

?php

$server='localhost';

$user='root';

$pass='12345';

$dbname='ppq';

$conn=mysql_connect($server,$user,$pass);

if(!$conn)

die("数据库系统连接失败!");

$result=mysql_list_tables($dbname);

if(!$result)

die("数据库连接失败!");

while($row=mysql_fetch_row($result))

{

echo

$row[0]."

";

}

mysql_free_result($result);

?

mysql_list_tables

(PHP

3,

PHP

4

,

PHP

5)

mysql_list_tables

--

列出

MySQL

数据库中的表

说明

resource

mysql_list_tables

(

string

database

[,

resource

link_identifier])

mysql_list_tables()

接受一个数据库名并返回和

mysql_query()

函数很相似的一个结果指针。用

mysql_fetch_array()或者用mysql_fetch_row()来获得一个数组,数组的第0列就是数组名,当获取不到时

mysql_fetch_array()或者用mysql_fetch_row()返回

FALSE。

php怎么获取数据库中表的id

//首先配置数据库连接

mysql_connect("localhost","root","");

mysql_select_db("db");

mysql_query("set names 'utf8'");

//写sql语句并执行

$sql="select id from 表名 where 条件"; 

$query=mysql_query($sql);

$rs=mysql_fetch_array($query);

//打印

echo $rs['id']


标题名称:php获取所有数据库名,php查询数据库数据
本文网址:http://scyingshan.cn/article/hshdij.html