On Sun, Mar 1, 2009 at 12:39 AM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> wrote: > On Sat, Feb 28, 2009 at 06:54:25PM -0500, Andrew Ballard wrote: > >> On Sat, Feb 28, 2009 at 6:08 PM, Paul M Foster <paulf@xxxxxxxxxxxxxxxxx> >> wrote: >> > On Sat, Feb 28, 2009 at 12:41:12AM +0000, Ashley Sheridan wrote: >> > >> >> On Fri, 2009-02-27 at 16:58 -0500, Bastien Koert wrote: >> > >> > <snip> >> > >> >> That'll just return an empty result set, as in empty and with no fields >> >> output! In MySQL you can do this: >> >> >> >> SELECT column_name FROM information_schema.columns WHERE table_name = >> >> 'table_name' >> >> >> >> this might help with doing the same for M$Access? >> >> >> > >> > This is the SQL standard way of doing this. Both MySQL and PostgreSQL >> > support it. Don't know about MSSQL. >> > >> > Paul >> > -- >> > Paul M. Foster >> > >> >> Access is not MSSQL, and I'd hardly consider it standard SQL either. >> :-) To even connect to it from PHP, I think you'd need to either use a >> generic ODBC library or else the COM or DOTNET libraries to use >> something like Microsoft's ADO library or similar. >> > > I don't know about the connection details. My point was that querying > the information_schema.columns and the like are the SQL standard way of > querying the database engine to determine the details of the database > and the tables. As I recall, MySQL had quite good tools for doing this, > and PostgreSQL didn't, until the SQL standard way of querying the > database about the database was implemented. > > Paul > > -- > Paul M. Foster The information_schema path doesn't appear to work for MS Access. (Like I said, I'd hardly call it a standard SQL database.) However, I was able to get a column list using the ODBC library: <?php $db_name = 'C:\Path\To\Access\Data\File\MyDatabase'; $dsn = 'Driver={Microsoft Access Driver (*.mdb)};Dbq=' . $db_name . '.mdb'; $table_name = 'MyTable'; $db = odbc_connect($dsn, null, null); $result = odbc_columns($db, $db_name, "", $table_name); echo odbc_result_all($result); ?> Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php