Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mssql_fetch_array(3) [php man page]

MSSQL_FETCH_ARRAY(3)													      MSSQL_FETCH_ARRAY(3)

mssql_fetch_array - Fetch a result row as an associative array, a numeric array, or both

SYNOPSIS
array mssql_fetch_array (resource $result, [int $result_type = MSSQL_BOTH]) DESCRIPTION
mssql_fetch_array(3) is an extended version of mssql_fetch_row(3). In addition to storing the data in the numeric indices of the result array, it also stores the data in associative indices, using the field names as keys. An important thing to note is that using mssql_fetch_array(3) is NOT significantly slower than using mssql_fetch_row(3), while it provides a significant added value. PARAMETERS
o $result - The result resource that is being evaluated. This result comes from a call to mssql_query(3). o $result_type - The type of array that is to be fetched. It's a constant and can take the following values: MSSQL_ASSOC, MSSQL_NUM, and MSSQL_BOTH. RETURN VALUES
Returns an array that corresponds to the fetched row, or FALSE if there are no more rows. EXAMPLES
Example #1 mssql_fetch_array(3) example <?php // Send a select query to MSSQL $query = mssql_query('SELECT [username], [name] FROM [php].[dbo].[userlist]'); // Check if there were any records if (!mssql_num_rows($query)) { echo 'No records found'; } else { // The following is equal to the code below: // // while ($row = mssql_fetch_row($query)) { while ($row = mssql_fetch_array($query, MSSQL_NUM)) { // ... } } // Free the query result mssql_free_result($query); ?> NOTES
Note Field names returned by this function are case-sensitive. Note This function sets NULL fields to the PHP NULL value. SEE ALSO
mssql_fetch_row(3). PHP Documentation Group MSSQL_FETCH_ARRAY(3)

Check Out this Related Man Page

PG_FETCH_ARRAY(3)														 PG_FETCH_ARRAY(3)

pg_fetch_array - Fetch a row as an array

SYNOPSIS
array pg_fetch_array (resource $result, [int $row], [int $result_type = PGSQL_BOTH]) DESCRIPTION
pg_fetch_array(3) returns an array that corresponds to the fetched row (record). pg_fetch_array(3) is an extended version of pg_fetch_row(3). In addition to storing the data in the numeric indices (field number) to the result array, it can also store the data using associative indices (field name). It stores both indicies by default. Note This function sets NULL fields to the PHP NULL value. pg_fetch_array(3) is NOT significantly slower than using pg_fetch_row(3), and is significantly easier to use. PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $row - Row number in result to fetch. Rows are numbered from 0 upwards. If omitted or NULL, the next row is fetched. o $result_type - An optional parameter that controls how the returned array is indexed. $result_type is a constant and can take the following values: PGSQL_ASSOC, PGSQL_NUM and PGSQL_BOTH. Using PGSQL_NUM, pg_fetch_array(3) will return an array with numerical indices, using PGSQL_ASSOC it will return only associative indices while PGSQL_BOTH, the default, will return both numerical and associa- tive indices. RETURN VALUES
An array indexed numerically (beginning with 0) or associatively (indexed by field name), or both. Each value in the array is represented as a string. Database NULL values are returned as NULL. FALSE is returned if $row exceeds the number of rows in the set, there are no more rows, or on any other error. EXAMPLES
Example #1 pg_fetch_array(3) example <?php $conn = pg_pconnect("dbname=publisher"); if (!$conn) { echo "An error occurred. "; exit; } $result = pg_query($conn, "SELECT author, email FROM authors"); if (!$result) { echo "An error occurred. "; exit; } $arr = pg_fetch_array($result, 0, PGSQL_NUM); echo $arr[0] . " <- Row 1 Author "; echo $arr[1] . " <- Row 1 E-mail "; // As of PHP 4.1.0, the row parameter is optional; NULL can be passed instead, // to pass a result_type. Successive calls to pg_fetch_array will return the // next row. $arr = pg_fetch_array($result, NULL, PGSQL_ASSOC); echo $arr["author"] . " <- Row 2 Author "; echo $arr["email"] . " <- Row 2 E-mail "; $arr = pg_fetch_array($result); echo $arr["author"] . " <- Row 3 Author "; echo $arr[1] . " <- Row 3 E-mail "; ?> SEE ALSO
pg_fetch_row(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_FETCH_ARRAY(3)
Man Page