Product Documentation

FairCom SQL for PHP

Previous Topic

Next Topic

ctsql_fetch_object

Fetches a result row as an object.

Declaration

object ctsql_fetch_object ( resource queryID)

Description

ctsql_fetch_object() is similar to ctsql_fetch_array(), with one difference; an object is returned instead of an array. Indirectly, this means you may only access the data by the field names, and not with the offsets (a number is an illegal property name).

Note: Field names returned by this function are case-sensitive.

Comparing performance, this function is identical to ctsql_fetch_array(), and is approximately as fast as ctsql_fetch_row().

Returns

Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows.

Example


<?php

ctsql_connect("localhost:ctreeSQL");


$result = ctsql_query("select * from mytable");

while ($row = ctsql_fetch_object($result)) {

echo $row->user_id;

echo $row->fullname;

}

ctsql_free_result($result);

?>


See also

ctsql_fetch_array(), ctsql_fetch_assoc(), ctsql_fetch_row().

TOCIndex