php man page for mysqli_fetch_row

Query: mysqli_fetch_row

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

MYSQLI_FETCH_ROW(3)							 1						       MYSQLI_FETCH_ROW(3)

mysqli_result::fetch_row - Get a result row as an enumerated array

       Object oriented style

SYNOPSIS
mixed mysqli_result::fetch_row (void )
DESCRIPTION
Procedural style mixed mysqli_fetch_row (mysqli_result $result) Fetches one row of data from the result set and returns it as an enumerated array, where each column is stored in an array offset starting from 0 (zero). Each subsequent call to this function will return the next row within the result set, or NULL if there are no more rows.
PARAMETERS
o $ result -Procedural style only: A result set identifier returned by mysqli_query(3), mysqli_store_result(3) or mysqli_use_result(3).
RETURN VALUES
mysqli_fetch_row(3) returns an array of strings that corresponds to the fetched row or NULL if there are no more rows in result set. Note This function sets NULL fields to the PHP NULL value.
EXAMPLES
Example #1 Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5"; if ($result = $mysqli->query($query)) { /* fetch object array */ while ($row = $result->fetch_row()) { printf ("%s (%s) ", $row[0], $row[1]); } /* free result set */ $result->close(); } /* close connection */ $mysqli->close(); ?> Example #2 Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } $query = "SELECT Name, CountryCode FROM City ORDER by ID DESC LIMIT 50,5"; if ($result = mysqli_query($link, $query)) { /* fetch associative array */ while ($row = mysqli_fetch_row($result)) { printf ("%s (%s) ", $row[0], $row[1]); } /* free result set */ mysqli_free_result($result); } /* close connection */ mysqli_close($link); ?> The above examples will output: Pueblo (USA) Arvada (USA) Cape Coral (USA) Green Bay (USA) Santa Clara (USA)
SEE ALSO
mysqli_fetch_array(3), mysqli_fetch_assoc(3), mysqli_fetch_object(3), mysqli_query(3), mysqli_data_seek(3). PHP Documentation Group MYSQLI_FETCH_ROW(3)
Related Man Pages
mysqli_use_result(3) - php
mysqli_data_seek(3) - php
mysqli_fetch_assoc(3) - php
mysqli_fetch_lengths(3) - php
mysqli_result.field_count(3) - php
Similar Topics in the Unix Linux Community
User Guide: Posting in the Emergency Forum
Rules for Homework &amp; Coursework Questions Forum
Status of UNIX.COM Forum Transformation
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Don Cragun
Denial Of Service Attack Update