mysql tutorial: read the data table field name mysql_fetch_field ()

Source: Internet
Author: User
Keywords Network programming Mysql tutorial
Tags data function mysql mysql tutorial mysql_fetch_field mysql_query name network

Now let's take a look at mysql_fetch_field () function, this function is to read mysql table name, field name. Here we take a look at the syntax of Oh.

mysql_fetch_field (data, field_offset) The mysql_fetch_field () function object is a recordset that returns the .mysql_query () function and returns an object on the success, or FALSE or fails when he has two parameters .data and field_offset data: Mandatory, Data pointer to use. The data pointer is due to the field_offset: optional from mysql_query (), which record to start reading, not writing code starting from 0. Now let's look at a mysql_fetch_field instance. <? $ Sql ​​= "SELECT * from a";

$ result = mysql_query ($ sql, $ con);

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

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.