UCP (HTML) help
#1

Hi. How can I center / position player's information where I want?

I was thinking somewith with CSS, but I have a PHP code


PHP код:
<?php 
include("config.php"); //including our config.php 
session_start(); //starting session 
error_reporting(0); 
if(isset(
$_SESSION['username'])) //if session is set, so if user is logged in... 

    
$username $_SESSION['username']; //setting variable username as one from session 
    
$query mysql_query("SELECT * FROM users WHERE username = '$username'");  //selecting all from table users where username is name that your is loged in 
    
echo "Welcome ".$_SESSION['username']; //saying welcome to user! 
    
while($row mysql_fetch_assoc($query)) //looping thousgt table to get informations 
    

        
$name $row['username']; //selecting user name, change 'username' to your field name 
        
$money $row['money']; //selecting user money, change 'money' to your field name 
        
$score $row['score']; //selecting user score, change 'score' to your field name 
        
$kills $row['kills']; //selecting user kills, change 'kills' to your field name 
        
$deaths $row['deaths']; //selecting user deaths, change 'deaths' to your field name 
    

    echo 
"<br><br>Name: ".$name."<br> Money: ".$money."<br> Score: ".$score."<br> Kills: ".$kills."<br> Deaths: ".$deaths

else 
header('location: login.php'); //if user isn't loged in it will redirect him on login.php 
?>
and it looks kind of ugly on my page.


http://vestigedayz.com/ucp/

Name: Test011
Password: test
Reply
#2

You've to use margin to change position
http://www.w3schools.com/css/css_margin.asp

NOTE: I am noob in this stuff
if I am not wrong this supposed to do your job

PHP код:

echo "<div style='margin-left: 50%;'>";
echo 
"Welcome ".$_SESSION['username']; //saying welcome to user!  
echo "</div>"
Reply
#3

I tried to color it but it gives me error



PHP код:
<span style="color:'#fffff'> ".$_SESSION['username']; </span
Reply
#4

What error(s) does the above code give you? I'd suggest using tables to layout your players statistics, it's much neater.
Reply
#5

Quote:
Originally Posted by Luis-
Посмотреть сообщение
What error(s) does the above code give you? I'd suggest using tables to layout your players statistics, it's much neater.
I have added this code on my css file

PHP код:
.daraka {
  
positionrelative;
  
colorrgba(2502502500.9);
  
height100vh;
  
width100%;
  
padding-top50%;
  


I used it to color

PHP код:
echo "<font color='white'><strong>Welcome,</strong> </font>" <div class="daraka"> .$_SESSION['username']; </div
ERROR:



PHP код:
Parse errorsyntax errorunexpected 'class' (T_CLASS), expecting ',' or ';' 

I just want to color it, the code works perfectly, only that I can't color Sessions
Reply
#6

because you've used more than one " symbol on php echo function this supposed to fix it
PHP код:
echo "<font color='white'><strong>Welcome,</strong></font> <div class='daraka'> $_SESSION['username'] </div>"
Reply
#7

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Reply
#8

echo "<font color='white'><strong>Welcome,</strong></font> <div class='daraka'> '.$_SESSION['username'].' </div>";
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)