Just to clarify...
A connection is to a server, not a table. The database name, when connecting, is just the default name to use if no db name is specified in the query. In this case, both connections are to "localhost" so a single connection will suffice.
If your tables were on different servers then you would need 2 connections and you would have to query the tables in separate queries,
One does not need to make 2 connections. Simply add the dbname to the tablename in your one query.
"select a.fld1, b.fld1,a.host, a.child, a...., b..., b... from db1.tablea a, db2.tableb b where a.key = b.key
first of all you should use an unique index for email and I don't understand the also having for username (though that too). Though I now can see both...tired.
Second take a look at this
$sql = "SELECT * FROM register WHERE username:username AND email:email";
See anything missing? I give you a hint it's between username :username and also email :email.
Here's a good link https://phpdelusions.net/pdo and I even still use it from time to time.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.