I wanted to get a list of all databases on a specific account on my server using PHP so I have used the following PHP/MySQL taken from this link: PHP - Get list of databases names
$db_conn = mysqli_connect('localhost', 'username', 'password');
//get a list of databases in the account
$result = mysqli_query($db_conn,"SHOW DATABASES");
//display results
while ($row = mysqli_fetch_array($result)) {
echo "database name - ".$row[0]."<br>";
}
This part works fine. But I now want to get the value of one specific row within a table in each of these databases, all databases contain exactly the same tables and therefore the same rows.
So inside the while { } I tried to put a SELECT statement:
$sql = "SELECT option_value FROM sweb_options WHERE option_name = 'siteurl'";
and then echoed $sql but this didn't do anything except output the statement. Any ideas how I can do this please?
Many thanks.