0

I am trying to get as much info as I can from a Microsoft Database using PHP and ODBC

What I need is :

  • List table names and fields
  • List queries and read/write their SQL
  • Create new tables and queries
  • Eventually write to a module

Is there any way to do this using ODBC or a third-party php module ?

PinkTurtle
  • 6,942
  • 3
  • 25
  • 44
  • 1
    For the first bullet: http://php.net/manual/en/function.odbc-tables.php For the rest I think you would just execute a query such as `ALTER TABLE`, `CREATE TABLE` etc... Just a guess I'm not into Access. – AbraCadaver Jul 07 '15 at 15:40
  • 1
    Have you looked at the [docs](http://php.net/manual/en/book.uodbc.php)? There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.I would suggest that you find a development forum (perhaps [quora](http://www.quora.com/Computer-Programming)?) to work out generalities. Then, when/if you have specific coding issues, come back to StackOverflow and we'll be glad to help. – Jay Blanchard Jul 07 '15 at 15:42
  • I merely needed a hint as to where start looking at, not a detailed answer to everything. I said Im looking for a *way* to do it, not *how* to do it. Btw I find your answer quite scornful. I'll be fine with the docs I guess. – PinkTurtle Jul 07 '15 at 15:52
  • try this https://gist.github.com/amirkdv/9672857 –  Jul 07 '15 at 15:58
  • I'll just go look at the odbc doc, thanks tho. – PinkTurtle Jul 07 '15 at 16:00
  • Do note, list of tables, fields, queries will require retrieving data from [system tables](http://stackoverflow.com/questions/201282/how-to-get-table-names-from-access). – Parfait Jul 08 '15 at 03:23
  • I found `odbc_tables` to retrieve a list of tables. Fields and queries I don't know. The real problem being : I need to be able to *create* tables, queries, eventually modules inside the `mdb` file. So far I didn't find anything that enables this. It must me part due to the fact Jet is a proprietary engine. I came to think I won't be able to create objects inside the `mdb` file. Even `mdbtools` says it provides access to `.mdb` in read-mode only (https://pecl.php.net/package/mdbtools). – PinkTurtle Jul 08 '15 at 08:37

0 Answers0