Different states

Hello, I am currently making a UCP, and I want the code to show Yes or No instead of 0 and 1 when a player is banned.

Just asking if someone could show me a example script.
Mysql name is Banned.

Right now its just Account Locked: [Banned]

Thanks!

You should add your code, it’s hard to help without having anything to go by. Basically it should be something like this

[php]Account Locked: <?= $banned ? 'yes' : 'no' ?>[/php]

That worked!

Thanks alot!

EDIT: It dont get updated when a player is banned

Here is some codes:

home.php
[php]<?php session_start();

if(!isset($_SESSION[‘LoggedIn’]))
{
header(“Location: index.php”);
}

include ‘tempfunctions.class.php’;

$Username = $_SESSION[‘Username’];

$mysqli = new mysqli(“DELETED”, “DELETED”, “DELETED”, “DELETED”);
$Template = new Template;

$results = $mysqli->query(“SELECT * FROM playerdata WHERE username = ‘$Username’”);
$Row = $results->fetch_array(MYSQLI_ASSOC);
$result = mysql_query(“SELECT * FROM playerdata WHERE username = ‘$Username’”);
while($row = mysql_fetch_array($result))
{
echo $row[‘Banned’] ? “Yes” : “No”;
}

foreach($Row as $Name=>$Value)
{
$Template->assign($Name, $Value);
}
$Template->loadpage(‘stats.php’);

?>[/php]

From stats.php:

[php]Account Locked: <?php echo $row['Banned'] ? "Yes" : "No"; ?>

[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service