I have a small and rather simple question I believe, however I have tried everything but I just can't figure out this syntax.
I will start by entering this code (php):
require_once('connectvars.php'); // My database connection
//Connect to the database
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
//Retrieve the data from the database
$query = "SELECT * FROM pbclickslogin WHERE username='$username'";
$data = mysqli_query($dbc, $query);
while ($info = mysqli_fetch_array( $data )) {
echo $info['lol']; echo $info['lol2'];
}
So I made up this example and let us say that "$info['lol'];" is a column inside a table named "pbclickslogin" and "$info['lol2'];" is a column inside a table named "pbclickssomethingelse". But I cannot connect to both databases at the same time, or can I?
I have tried adding:
$query = "SELECT * FROM pbclickslogin, pbclickssomethingelse WHERE username='$username'";
and this:
$query = "SELECT * FROM pbclickslogin WHERE username='$username'";
$query2 = "SELECT * FROM pbclickssomethingelse WHERE username='$username'";
$data = mysqli_query($dbc, $query, $query2);
while ($info = mysqli_fetch_array( $data )) {
echo $info['lol']; echo $info['lol2'];
}
but as some of you experienced PHP users might know. These two things did not solve my problem. Do any of you have an idea of how I can connect to both of these databases while doing the while loop?