Home >Backend Development >PHP Tutorial >Usage of php mysql_field_type() function

Usage of php mysql_field_type() function

怪我咯
怪我咯Original
2017-07-06 11:24:141603browse

This article mainly introduces the usage of the mysql_field_type() function in PHP, and analyzes in more detail the method of using the mysql_field_type() function to obtain the specified field type, which is PHP+ Very practical skills in MySQL programming, friends in need can refer to

This article explains the usage of the mysql_field_type() function in PHP with examples. Share it with everyone for your reference. The details are as follows:

Definition and usage: mysql_field_type() function returns the type of the specified field in the result set. If successful, it returns the type of the specified field. If it fails, it returns false.

Syntax: mysql_field_type(data,field_offset)

Parameter Description
data Required, The data pointer to use, which is the result returned from mysql_query().
field_offset Required, indicating which field to start from Return, 0 indicates the first field.

## The code is as follows:

<?php 
mysql_connect("localhost","root",""); 
mysql_select_db("mydatabase"); 
$query = "SELECT id as ID, title FROM mytable ORDER BY title"; 
$result = mysql_query($query); 
$row = mysql_fetch_row($result); 
echo mysql_field_type($result, 0); 
?>

The above is the detailed content of Usage of php mysql_field_type() function. For more information, please follow other related articles on the PHP Chinese website!

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