Jump to content

BizzyD

Members
  • Posts

    10
  • Joined

  • Last visited

BizzyD's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I did this: $result = mysqli_query($con,"SELECT * FROM playerdata WHERE AdminLevel = '6'"); That did not work
  2. Hello, I got an issue with with php + mysql. I am trying to make a page where it shows the online admins. But right now, it selects all the users. How do I change it so it only chooses players that has AdminLevel set to 1 or higher? Code. <?php session_start(); $con=mysqli_connect("localhost","root","DELETED","DELETED"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM playerdata"); while($row = mysqli_fetch_array($result)) { echo $row['username'] . " " . $row['online_ig']; echo "<br>"; } mysqli_close($con); ?>
  3. Hello, I have some issues with a php code. It refuses to load the webpage for me. This is the line in stats.php: <b>Talent:</b> <?php echo $talents[$row["Skill"]]; ?> <br> This is where the arrays get loaded: - home.php <?php session_start(); if(!isset($_SESSION['LoggedIn'])) { header("Location: index.php"); } include 'tempfunctions.class.php'; $Username = $_SESSION['Username']; $mysqli = new mysqli("localhost", "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)) { $talents = array("Technician","Hunter","Fisherman","Drug Addict","Hoarder","Doctor"): } foreach($Row as $Name=>$Value) { $Template->assign($Name, $Value); $talents = array("Technician","Hunter","Fisherman","Drug Addict","Hoarder","Doctor"): } $Template->loadpage('stats.php'); ?> What is the error?
  4. Fixed it. Thanks for the help This did the trick: <?php echo ([Banned] === 1) ? 'Yes' : 'No'; ?> one more question, how do I do it, if its set to 0 it says none. But if its higher then 1, it display the number
  5. Sorry, Here is home.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'); ?> And the echo code: <?php echo $row['Banned']; ?>
  6. New code is: <?php echo $row['Banned']; ?> Now it wont show anything
  7. Hello, I just wanna say that im new to php. So I am a little bit of a newb. But anyways, im trying to make a ucp, and in the page, I have a section: Account Locked : Yes/No. Well it should be like that, but its only showing Account Locked: This is the line that should show the ban: <?php echo $row['Banned']; ?> But it dont show anything. I want it to show Yes or No. in the database its 0 or 1. What should I do?
  8. Hey, Will try that! Right now its like this: <b>Account Locked:</b> [banned]
  9. 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!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.