Get the name of the column
am 30.10.2007 19:55:21 von Jorge Reyes
hi there, this is very useful for me, so my issue is, when i use a
$result = sybase_query("sp_something")
while($r = sybase_fetch_array($result)) {
etc.....
how can i get the name of the columns? for example for the raw data
Col1 Col2 Col3
-------------------------------------
hi 15 other value
how can i get the values "Col1", "Col2", "Col3"....
please, thanks for advanced.
Re: Get the name of the column
am 30.10.2007 20:24:52 von Jeremy
Jorge Reyes wrote:
> hi there, this is very useful for me, so my issue is, when i use a
> $result = sybase_query("sp_something")
> while($r = sybase_fetch_array($result)) {
> etc.....
>
> how can i get the name of the columns? for example for the raw data
>
> Col1 Col2 Col3
> -------------------------------------
> hi 15 other value
>
>
> how can i get the values "Col1", "Col2", "Col3"....
> please, thanks for advanced.
>
The fetch_array functions return an associative array, where the keys
are the column names. So to get an array of the column names, you can
use the array_keys function:
$keys = array_keys($result);
More info:
http://us3.php.net/manual/en/function.array-keys.php
Jeremy