Home > Backend Development > PHP Tutorial > mysql tutorial: Reading data table field names mysql_fetch_field()_PHP tutorial

mysql tutorial: Reading data table field names mysql_fetch_field()_PHP tutorial

WBOY
Release: 2016-07-13 17:04:02
Original
1386 people have browsed it

Now let’s take a look at the mysql_fetch_field() function. This function reads the example name and field name of the mysql data table. Let’s take a look at its syntax.

mysql_fetch_field(data,field_offset)
Copy after login
<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";
Copy after login
 
Copy after login
$result = mysql_query($sql,$con);
Copy after login

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

The output result is all the field names of your data table.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630897.htmlTechArticleNow let’s take a look at the mysql_fetch_field() function. This function reads the example name of the mysql data table. Field name. Let’s take a look at its syntax. mysql_fetch_field(data,field_o...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template