note 109233 modified in function.db2-field-name by salathe

From: Date: Fri, 02 Jan 2015 11:27:34 +0000
Subject: note 109233 modified in function.db2-field-name by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201317@lists.php.net to get a copy of this message
example: <?php // select all fields from salay table $sql = "SELECT * FROM SALARY"; $stmt = db2_prepare($conn,$sql); if(db2_execute($stmt)){ $columns = db2_num_fields($stmt); for($i=0;$i<$columns;$i++){ $fieldName[] = db2_field_name($stmt,$i); } print_r($fieldName); }else{ echo db2_stmt_errormsg(); } /* output * Array ( [0] => ID [1] => USERID [2] => VALUE ) */ ?> --was-- example: <?php // select all fields from salay table $sql = "SELECT * FROM SALARY"; $stmt = db2_prepare($conn,$sql); if(db2_execute($stmt)){ $columns = db2_num_fields($stmt); for($i=0;$i<$colums;$i++){ $fieldName[] = db2_field_name($stmt,$i); } print_r($fieldName); }else{ echo db2_stmt_errormsg(); } /* output * Array ( [0] => ID [1] => USERID [2] => VALUE ) */ ?> http://php.net/manual/en/function.db2-field-name.php

« previous php.notes (#201317) next »