Today I have a problem and I have a php code that I had some problems to continue and the problem is that I have the following code:
my problem is that the prefix table of the database is s2_ and therefore I indicate there that I want the data of said table called users, but the problem is that I have several databases and they are similar they all have the field user , but the prefixes of the databases are different, I have them in descending form, ie travianf_s1 with prefix s1_, travianf_s2 with prefix s2_ and so on until reaching the database number 8 are in total, so I need to know how to indicate in the code that I need the data of a database adding in the code the name of the database that I want!, from now I thank you infinitely as I can add the name of the database to this code
for linux
<?php
$return = mysqli_query($link,"SELECT Count(*) as Total
FROM " . s2_ . "users WHERE timestamp > ".(time() -
(3600*168))." AND tribe!=0 AND tribe!=4 AND tribe!=5");
$online=(!empty
($return))? mysqli_fetch_assoc($return)['Total']:0;
echo $online;
?>
Hello dear friend the question is the following I have a game in which I have 8 servers online, but in each server there is an image describing the number of players online and the number of players registered in the server I have 8 databases in my Previously hosting when I had a free hosting was that I put all the databases in one and had no problems because it only changed the prefix of the database and was already connected
the problem is that the game requires to be restarted at every moment and I find it very difficult and tedious to have to be eliminating the tables of the servers that have finished, so I want to have 8 different databases to just have to enter phpmyadmin and delete all tables from the database, please I need help xD
If you have all databases on same server then you may play with record as follow
SELECT DATABASE_A.TABLE_A.FIELD_A, DATABASE_B.TABLE_B.FIELD_B
FROM ......
Here is a detail in FAQ section, how to play between databases. You may ask them, They'll reply you with in 24 hours.
Hope my solution helps you. Thanks