ODBC, PHP and a lack of understanding.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

My problem consists of two parts, the first of which I imagine is only
a matter of syntax whilst the second might very well be impossible.

I'm not sure if it is of consequence but PHP is running on a Win2000
machine and the ODBC connection in question links to an MS-Access

1/ I am trying to get my head around odbc_columns().  When using the
function in its simple case -- just providing a ODBC link -- all is
fine and it returns a dataset of all the columns in all the tables
fine.  The problem is that I cannot ask it to list _all_ the columns
each time and I would like to be able to inspect just one table's
columns.  (A major reason for this is that the target database
contains hundreds of tables and so odbc_columns() takes a long time to

Trouble is I don't posses enough knowledge of DB systems to understand
what is meant by the qualifier and schema parameters, anyone had any
success in this area?

2/  I grant that this doesn't seem to have a solution but I thought
I'd ask just in case... basically I'm looking for an equivalent of
mysql_field_table() but for ODBC.  Either that or some way of
determining the source table of a given field from a resultset or even
the original SQL statement.

Any help would be greatly appreciated.


Re: ODBC, PHP and a lack of understanding.

phil@openaccess.tv (evilbreadbin) wrote in message
Quoted text here. Click to load it

For anybody having similar problems I have now managed to get the
first part of this working.  Here is a working example:

  $conn_ODBC = odbc_connect("peopledb", "Admin", "") or die;
  $result = odbc_columns($conn_ODBC, "peopledb", "", "people");

Where the second param of odbc_columns() is the DNS ODBC link, the
third a zero length string and the forth the table name.

Still don't have a solution to the second part, I'm thinking of doing
a simplistic SQL parser to pull the information directly from the SQL
Statement -- clearly not a preferred solution but it is the only one I
see.  Therefore I'd be grateful for any other advice on the matter.


Site Timeline