Home > Backend Development > PHP Problem > What does result mean in php

What does result mean in php

WBOY
Release: 2023-03-14 18:56:01
Original
5192 people have browsed it

In PHP, result means "result". The "mysql_result()" function is used to return the value of a field in the result set. If successful, the function returns the field value. If it fails, it returns false. , the syntax is "mysql_result(data,row,field)".

What does result mean in php

The operating environment of this tutorial: windows10 system, PHP7.1 version, DELL G3 computer

The result in php is What does it mean

mysql_result() function returns the value of a field in the result set.

If successful, the function returns the field value. If failed, returns false.

Syntax

mysql_result(data,row,field)
Copy after login

Parameter Description

data Required. Specifies the result identifier to use. This identifier is returned by the mysql_query() function.

row Required. Specify the line number. Line numbers start from 0.

field is optional. Specifies which field to retrieve. Can be a field offset value, field name or table.fieldname.

If this parameter is not specified, this function gets the first field from the specified row.

Note

When working with large result sets, you should consider using a function that can retrieve the entire row. These functions return the contents of multiple units in a single function call, much faster than mysql_result().

Also note that specifying a numeric offset in the field parameter is much faster than specifying the field name or tablename.fieldname.

Example

<?php
$con = mysql_connect("localhost", "hello", "321");
if (!$con)
  {
  die(&#39;Could not connect: &#39; . mysql_error());
  }
$db_selected = mysql_select_db("test_db", $con);
$sql = "SELECT * from Person";
$result = mysql_query($sql,$con);
echo mysql_result($result,0);
mysql_close($con);
?>
Copy after login

The output result is similar to Adams

If you are interested, you can click on "PHP Video Tutorial" to learn more about PHP knowledge study.

The above is the detailed content of What does result mean in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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