Jump to content

Recommended Posts

[!--quoteo(post=350224:date=Feb 28 2006, 09:56 AM:name=R1der)--][div class=\'quotetop\']QUOTE(R1der @ Feb 28 2006, 09:56 AM) [snapback]350224[/snapback][/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

[code]name:<? echo $userid ?>[/code]

can anyone help me with this little problem?

Thanks in advance.
[/quote]


Put a ';' after the variable

[code]name:<? echo $userid; ?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/3754-display/#findComment-13013
Share on other sites

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

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

thanks for the speedy reply but that didnt solve the problem it still dont display the userid :(
Link to comment
https://forums.phpfreaks.com/topic/3754-display/#findComment-13016
Share on other sites

[!--quoteo(post=350230:date=Feb 28 2006, 10:09 AM:name=komquat)--][div class=\'quotetop\']QUOTE(komquat @ Feb 28 2006, 10:09 AM) [snapback]350230[/snapback][/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

[code]<?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>[/code]
Link to comment
https://forums.phpfreaks.com/topic/3754-display/#findComment-13020
Share on other sites

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
Link to comment
https://forums.phpfreaks.com/topic/3754-display/#findComment-13022
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.