RE: [PHP-WIN] Getting Field Names in Microsoft SQL

2002-08-19 Thread Svensson, B.A.T. (HKG)
> 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 wo

RE: [PHP-WIN] Getting Field Names in Microsoft SQL

2002-08-16 Thread Scott Carr
A more portable way would be the following (I am using PEAR::DB, but you could use the native driver as long as it returns an Associative Array.: include 'db.php'; $db = DB::connect($dsn); $strSQL = "SELECT * FROM {Table}"; $row = $db->getRow($strSQL, DB_FETCHMODE_ASSOC); $field_names = array_ke

RE: [PHP-WIN] Getting Field Names in Microsoft SQL

2002-08-16 Thread David Hollister
Database jargon can always be a factor in clear communication, so I'll be careful in my suggestions. I take your question to mean: "how do I return the column names from any given table within MS SQL?" If that's what you want, you need to select information from the [syscolumns] table in your da