The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Display online players
BizzyD
post Oct 13 2014, 10:17 AM
Post #1





Group: Members
Posts: 6
Joined: 14-November 13
Member No.: 19,984



Hello, I am coding a small UCP. And I want to show all the online admins. It works but I want it to show a picture instead of saying ex: Bizzy_D 1. It should be Bizzy_D PICTURE.

This is my code:

CODE
<html>
<head>
<title>Island Survival Roleplay</title>
<link href="./style/main.css" rel="stylesheet" type="text/css">

<script src="./includes/jquery-1.9.1.js" type="text/javascript"></script>

<script type="text/javascript">
</script>
</head>

<body>
<nav>
<ul>
<li><a href="./home.php"><img border="0" src="style/images/home.png"></a><a href="./logout.php"><img border="0" src="style/images/logout.png"></a></li>
</ul>
</nav>
<div class="container">
<div class="ribbon">Staff Page
</div>
<div class="defbox">
</div>
</body>
</html>


<?php
$con=mysqli_connect("localhost","root","","MyDB");

if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,"SELECT * FROM playerdata WHERE AdminLevel = 1 OR AdminLevel = 2 OR AdminLevel = 3 OR AdminLevel = 4 OR AdminLevel = 5 OR AdminLevel = 6");

while($row = mysqli_fetch_array($result))
  {
  echo $row['username'] . " " . $row['online_ig'];
  echo "<br>";
  }

mysqli_close($con);
?>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 13 2014, 10:38 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Did you write the program yourself? If so, you should be able to show just the bit of code that produces the usernames.

Once you have the username, you just echo an html <img> tag for the image. Obviously you need to have the images available, and a way of getting the right image file name, either by including the username in the filename, or with a column in the DB which tells you the filename. This is actually completely trivial; if you need help in doing it, say which bit you don't understand. (If you want someone to do it for you, you should expect to pay them a small fee.)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 11:25 AM