PHP and MySql
Posted: Sun Jan 04, 2009 5:01 pm
I'm trying to change the field 'accesslevel' in the database, from a user defined name.
<?php
$username = "root";
$password = "sqlpassword";
$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
?>
<html><title>Admin Panel</title><body>
Ban an account.<br>
<br>
<form action =ban.php method=post>
Character Name:
<input type="text" name="character" />
<input type="submit" />
</form>
This is where the user puts in the name of the person who's accesslevel will be changed.
<?php
$username = "root";
$password = "sqlpass";
$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
$name = $_post ["character"]
$account = mysql_query("select accountname from characters where charname='$name'");
mysql_query("UPDATE accounts SET accesslevel = '0'
WHERE username = '$account'");
echo "The Account: $account has been banned."
?>
This should find the name the user typed in in the characters database, and set his 'accountname' to the variable $account.
It should then update the accounts database to set his accesslevel to 0. This isn't working though. Any ideas why?

<?php
$username = "root";
$password = "sqlpassword";
$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
?>
<html><title>Admin Panel</title><body>
Ban an account.<br>
<br>
<form action =ban.php method=post>
Character Name:
<input type="text" name="character" />
<input type="submit" />
</form>
This is where the user puts in the name of the person who's accesslevel will be changed.
<?php
$username = "root";
$password = "sqlpass";
$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
$name = $_post ["character"]
$account = mysql_query("select accountname from characters where charname='$name'");
mysql_query("UPDATE accounts SET accesslevel = '0'
WHERE username = '$account'");
echo "The Account: $account has been banned."
?>
This should find the name the user typed in in the characters database, and set his 'accountname' to the variable $account.
It should then update the accounts database to set his accesslevel to 0. This isn't working though. Any ideas why?