The code should take the IDs and delete them from the tables but it isn't we are getting errors. Anyone see anything wrong?
<?php
###############
# Prune.php #
###############
//Variables
$dbhost = "localhost"; //host name
$dbuser = "root"; // username for db
$dbname = "dbname"; // database name
$dbpass = ""; //password for db
$error = "There was a problem connecting to the database"; // error statement
//connect to db
mysql_connect ($dbhost, $dbuser, $dbpass) or die ($error);
mysql_select_db($dbname);
$lastlogin = "1";
$query = "SELECT id FROM accounts WHERE lastlogin < CURRENT_TIMESTAMP() - $lastlogin";
$result = mysql_query($query) or die ('Error: '.mysql_error ());
while ($players=mysql_fetch_array($result)){
mysql_query("DELETE FROM buddies WHERE characterid = $players");
mysql_query("DELETE FROM inventoryitems WHERE characterid = $players");
mysql_query("DELETE FROM skills WHERE characterid = $result");
mysql_query("DELETE FROM keymap WHERE characterid = $players");
mysql_query("DELETE FROM characters WHERE accountid = $players");
}
?>