So, as the title states; I have a Minecraft server, and a Wordpress website.
Both server players and wordpress users have matching names.
I would like a code that will use the player's wordpress username to retrieve same-name player data from other tables on the server.
These other tables are created by Minecraft.
I am having some trouble with adding the current user's login_name to the SQL query. They are identical, but I cannot figure out how to get the current user's info to be placed into the SQL query.
This is the base type of script I am using: Any help for my issue? Thanks!
//Sample Database Connection Script
//Setup connection variables, such as database username
//and password
$hostname="localhost";
$username="REDACTED";
$password="REDACTED!!";
$dbname="mineassa_money";
$dbtable="moneysql";
//Connect to the database
$connection = mysql_connect($hostname, $username, $password);
mysql_select_db($dbname, $connection);
//Setup our query
$query = "SELECT money FROM `moneysql` WHERE `last_known_name`>=$user_login;";
//Run the Query //Run the Query
$result = mysql_query($query);
$data=mysql_fetch_assoc($result);
echo $data['total'];
//If the query returned results, loop through
// each result
if($result)
{
while($row = mysql_fetch_array($result))
{
$name = $row["$yourfield"];
echo "Name: " . $name;
}
}