RE: [PHP-WIN] Getting Field Names in Microsoft SQL
| From: | HKG) | Date: | Mon, 19 Aug 2002 08:46:32 +0000 |
| Subject: | RE: [PHP-WIN] Getting Field Names in Microsoft SQL | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-15342@lists.php.net to get a copy of this message | ||
> include 'db.php';
> $db = DB::connect($dsn);
> $strSQL = "SELECT * FROM {Table}";
> $row = $db->getRow($strSQL, DB_FETCHMODE_ASSOC);
>
> $field_names = array_keys($row);
>
> Iterate $field_names for the field names from the table. This should work for
> any database that PHP can use.
Just a word of caution:
May be true as long as the column (filed) is not an aggregate (for ex SUM(), MAX(), isnull(), etc,
etc) and do not miss the AS
keyword.