Code: Select all
<?php
$username = "root";
$password = "password";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("flyff",$dbhandle)
or die("Could not select database");
//Connected to database, below is functionality
//Select Character name from form
$name = $_POST ["character"];
//Find characters account name
$accountQuery = mysql_query("select accountname from characters where charname='$name'");
$account = mysql_result($accountQuery, 0, "accountname");
//Update accesslevel for account
mysql_query("UPDATE accounts SET accesslevel = '0' WHERE username = '$account'");
//Text feedback.
echo "The Account:";
echo $account;
echo "has been banned.";
?>
If anybody can read over and debug my code, it will be greatly appreciated