I need to connect to two databases using PHP and use the results from the first query to get the rest of the data I need out of a second database.
So for the second c
You would need to make 2 different connections
Now when you use the $mysqliDB1->....
you are talking to the DB1 database and when you use the $mysqliDB2->....
you are talking to the DB2 database
So
$client = $mysqliDB1->query("SELECT client FROM appointments WHERE ID = $results")
->fetch_object();
$locn = $mysqliDB2->query("SELECT state,zipcode
FROM location
WHERE ClientID = {$client->FirstName}")
->fetch_object();
echo $locn->state;
echo $locn->zipcode;
I am guessing the table name and so on, but I am not clarevoyant so you will have to fill that in for yourself.