SQLite Forum

[Solved] OPEN, ATTACH, CREATE VIEW, SELECT - possible?
Several new (to you) facts will help:

1. When you use "ATTACH ... AS Something;", then "Something" is a "schema" name, not a table name. (See [ATTACH doc](https://sqlite.org/lang_attach.html)).

2. A view cannot be created in one database (or schema) which references objects in another database. This is because a view should remain valid whether other DBs are attached or not.

3. You would probably find it easier to develop your database table/view structure (aka "schema") using a different tool which does not disguise errors as well as PHP.  The [SQLite CLI shell](https://sqlite.org/cli.html) would be one such tool.

And, a not-so-new fact:

4. fetchArray() and PHP generally are not quite on-topic here. However, virtually anything happening with that CLI shell is.