odbc_fetch_into

bool odbc_fetch_into(resource result, int row, array array) 

Fetches row data from a query.

Returns:

TRUE on success; FALSE on error

Description:

Fetches a row of data into the array passed to the function by reference. Column numbering starts at 0, so it’s important to keep track of field order. It can be a bad idea to use SELECT * FROM table in a query when using this function, as the order of columns returned cannot always be guaranteed.

Version:

Existing since version 3.0.6

Example:

Display query results
$db = odbc_connect("DSN","user","pass"); 
$sql = "SELECT ProductName, UnitPrice FROM Products"; 
$result = odbc_exec($db, $sql); 
while (odbc_fetch_into($result, &$row)) {
   echo "$row[0] $row[1]\n"; 
} 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.