Jump to content


Photo

Display


  • Please log in to reply
5 replies to this topic

#1 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 28 February 2006 - 02:56 PM

Basicly when the user logs in i want it to display info from ther database to them i.e username , level , money. but when i do the cod eit wont work. this is the code i use to try and display then

name:<? echo $userid ?>

can anyone help me with this little problem?

Thanks in advance.

#2 komquat

komquat
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts
  • LocationHoughton, MI

Posted 28 February 2006 - 03:00 PM

[!--quoteo(post=350224:date=Feb 28 2006, 09:56 AM:name=R1der)--][div class=\'quotetop\']QUOTE(R1der @ Feb 28 2006, 09:56 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Basicly when the user logs in i want it to display info from ther database to them i.e username , level , money. but when i do the cod eit wont work. this is the code i use to try and display then

name:<? echo $userid ?>

can anyone help me with this little problem?

Thanks in advance.
[/quote]


Put a ';' after the variable

name:<? echo $userid; ?>


#3 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 28 February 2006 - 03:05 PM

[!--quoteo(post=350225:date=Feb 28 2006, 10:00 AM:name=komquat)--][div class=\'quotetop\']QUOTE(komquat @ Feb 28 2006, 10:00 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Put a ';' after the variable

name:<? echo $userid; ?>
[/quote]

thanks for the speedy reply but that didnt solve the problem it still dont display the userid :(


#4 komquat

komquat
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts
  • LocationHoughton, MI

Posted 28 February 2006 - 03:09 PM

Try posting more code, it must be something before that line.

#5 R1der

R1der
  • Members
  • PipPipPip
  • Advanced Member
  • 104 posts

Posted 28 February 2006 - 03:12 PM

[!--quoteo(post=350230:date=Feb 28 2006, 10:09 AM:name=komquat)--][div class=\'quotetop\']QUOTE(komquat @ Feb 28 2006, 10:09 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try posting more code, it must be something before that line.
[/quote]


this is the whole of my code in this file

<?php
session_start();

if (!isset($_SESSION['image_is_logged_in']) || $_SESSION['image_is_logged_in'] !== true) {
    // not logged in, move to login page
    header('Location: login.php');
    exit;
}
?>
<html>
<head>
<title>Lost City Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p> </p>
<p><b>Name:<? echo $userid; ?><br>
Money:<? echo $money ?><br>
Energy:<? echo $energy ?><br>
<br>
Main</b></p>
<p><a href="index.php">Home</a> </p>
<p><a href="items.php">Items</a> </p>
<p><a href="mail.php">Mailbox</a> </p>
<p><a href="town.php">Town</a> </p>
<p><a href="news.php">Newspaper</a> </p>
<p><a href="forum.php">Forums</a> </p>
<p><a href="chat.php">Chat</a> </p>
<br>
<b>Preferences<br>
<br>
<p><a href="account.php">My Account</a> <br>
<p><a href="help.php">Help Guide</a> <br>
<p><a href="logout.php">Logout</a> <br>
</b> </p>
</body>
</html>


#6 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 28 February 2006 - 03:18 PM

this code looks very alike mine...

you havnt set what the $userid is...
as your using sessions, i guess you want it to load from another page...

on a login page... add this line to add it to sessions

$_SESSION['userid']=$userid;

and on that other page, use

<p><b>Name:<? echo $_SESSION['userid']; ?><br>

and it will load it from the session
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users