I have a problem. I have two sqlite files and I need (with PHP) to make a join on both of these databases. So first I would like to attach them together but I don’t know how to do that.
Here’s my tiny script :
class PA_SQLModel extends SQLite3
{
function __construct($name)
{
$this->open($name);
}
}
$firstDB = new PA_SQLModel('firstDB.sqlite');
$secondDB = new PA_SQLModel('secondDB.sqlite');
Thanks for your help !
yes that’s pretty is how you can acess the both sqlite databases from one php script, but i believe you can’t make a JOIN query, since its 2 different databases, two different resources, and each time you have to query the databases you must use 1 resource.
so only option i think is left in PHP which can process the results , let’s say arrays from query1 in resource#1 and query2 in resource#2 , you can merge/slice/push/pop and generally manipulate the array to get desired result.
one more option is to copy all tables from X database to Y and use prefixes like fDB_users, sDB_users, this will solve the name conflicts, and give you the option to run complex queries instead of manipulating the results of queries in php.