|
wb_fetch_row | PHP Interface | wb_result_all |
This function provides a basic method for getting data from an open cursor. Works with the current record. In order to set the current record, use the wb_fetch_row or wb_data_seek function.
Value of the specified attribute in the current record. See Passing values from 602SQL to PHP. FALSE is returned if an error occurs, and the error is reported by the standard mechanisms of PHP.
WARNING: If you read the value of the variable-length type column (BLOB, CLOB, etc.), only the beginning segment of the column value will be read (the length of the segment is set by the global parameter longreadlen, see also Manipulating variable-length types in PHP).
WARNING: If you read the value of the BOOLEAN type column, the PHP values may be only TRUE or FALSE. NULL value is read as FALSE! In order to recognize the NULL value you must also call the is_null() PHP function.
A typical way to reading data from a cursor is from a loop:
$cursor=wb_exec($connection, "SELECT ID,order_date FROM..."); while (wb_fetch_row($cursor)) { echo( wb_result($cursor, 1).": <i>".wb_result($cursor, 2)."</i><br>"); //echo( wb_result($cursor, "id").": <i>".wb_result($cursor, "order_date")."</i><br>"); }
Reading a CLOB value (in the WB_LOBMODE_DIRECT mode):
$cursor=wb_exec($connection, "SELECT clob_column,CHAR_LENGTH(clob_column) AS clob_length FROM my_table"); while( wb_fetch_row($cursor) ) { // get the CLOB length $clob_length=wb_result($cursor,2); // set the INI parameter wb_longreadlen so I can read the whole CLOB ini_set("wb_longreadlen",$clob_length); // read the CLOB into the PHP variable $clob $clob=wb_result($cursor,1); }
wb_fetch_row | PHP Interface | wb_result_all |