search
Homephp教程php手册mysql教程:读取数据表字段名 mysql_fetch_field()

现在我们来看看 mysql_fetch_field()  函数吧,这个函数 是就读取mysql 数据表的例名,字段名.下面我们来看看它的语法哦.

mysql_fetch_field(data,field_offset)
<p><strong>mysql_fetch_field()</strong> 函数对像是记录集返回.mysql_query ( )函数并返回一个对象上的成功,或FALSE或失败时</p><p> </p><p>他有两个参数.data 与 field_offset</p><p> </p><p>data:必选若,指定的数据指针使用。数据指针是由于从mysql_query ( )函数</p><p> </p><p>field_offset:可选,从哪条记录开始读取,不写是代码从0开始.</p><p> </p><p>现在我们来看一个mysql_fetch_field实例.</p><p></p><pre class="brush:php;toolbar:false">$sql = "SELECT * from a";
 
$result = mysql_query($sql,$con);

 

while ($property = mysql_fetch_field($result)) { echo "Field name: " . $property->name . "
"; }

 

输出的结果就是你数据表的所有字段名哦.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.