You can take my help or you can leave it but I think you need to switch over to mysqli or PDO, in this case I am using PDO. I feel PDO while it can be difficult to understand at first will become really easy to understand.
I’ll jump into the code right away then explain a few things afterwords:
[php]<?php
/* important! use actual prepared statements (default: emulate prepared statements) /
/ throw exceptions on errors (default: stay silent) /
/ fetch associative arrays (default: mixed arrays) */
$db_options = array(
PDO::ATTR_EMULATE_PREPARES => false
, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
/* Make the connection to the database */
$pdo = new PDO(‘mysql:host=localhost;dbname=games;charset=utf8’, ‘username’, ‘password’, $db_options);
/* Set the query variable */
$query = ‘SELECT id, banner, reason, player, status, score FROM bungeebans ORDER BY player’;
/* Prepare the Query for Execution /
$stmt = $pdo->prepare($query);
/ Execute the Query */
$stmt->execute();
?>
Untitled Document
<?php
/* Even though you executed the query, you still need */
/* to fetch the rows and in this case it is an */
/* associative array that is put into $row. */
while ( $row = $stmt->fetch(PDO::FETCH_ASSOC) ) {
if ( $row['status'] == 'banned' ) {
echo '
Player ' . $row['player'] . ' was banned by ' . $row['banner'] . ' and the reason is ' . $row['reason'] . '
' . "\n";
} else {
echo '
Player ' . $row['player'] . ' score is ' . $row['score'] . ' points
' . "\n";
}
}
?>
[/php]
Now, I Re-Structured your database table to this:
[code]CREATE TABLE IF NOT EXISTS `bungeebans` (
`id` int(5) NOT NULL,
`banner` varchar(60) COLLATE utf8_bin NOT NULL,
`reason` varchar(120) COLLATE utf8_bin NOT NULL,
`player` varchar(60) COLLATE utf8_bin NOT NULL,
`status` varchar(30) COLLATE utf8_bin NOT NULL,
`score` int(6) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=8 ;
[/code]
The reason I did this is that it is easier to let the mysql handle all the data and php hand all the processing data (well as much as possible). My suggestion is study up on PDO by going to http://php.net/manual/en/pdostatement.fetch.php and checking out all the PDO Methods (Functions). Like I said you can take my help or not, but I think you would be better if you took it, instead of using obsolete code.