Re: return array
| From: | Torsten Roehr | Date: | Sat, 26 Jun 2004 09:09:08 +0000 |
| Subject: | Re: return array | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34977@lists.php.net to get a copy of this message | ||
>"Sukanto Kho" <starofflame@hotmail.com> wrote in message
news:BAY2-DAV15VJbrzvsTD0001305f@hotmail.com...
>Hi All,
>
>how to return array var from function ??
>
>I have try that but just can't return it..
>
>here's my code :(function to return any fields name from table)
>
> function fields($table,$db_name)
>{ $link=$this->database(); // this open the database connection
> $fields = mysql_list_fields($db_name, $table, $link);
> $columns = mysql_num_fields($fields);
> for ($i = 0; $i < $columns; $i++) {
> $field[$i] = mysql_field_name($fields, $i);}
> return $field[];
> }
Do a print_r($field) instead of return $field to see if the contents is what
you are expecting.
Regards, Torsten Roehr