Jump to content


Photo

echos


  • Please log in to reply
4 replies to this topic

#1 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 18 April 2006 - 12:05 AM

well, my problem is not the echoing itself it is the calling of the queries within the echo.

<?php
session_start();

//this code is compyright to supanoob http://www.twottk.com
// to use this code you must have his permission to gain
// permission please mail him at webmaster@twottk.com
require_once('header.php');

if (!$_SESSION['valid_user']) 

{ echo 'you are not logged in'; 

die();
} 


$query="select playerid, user, email, fatigue, maxfat, power, speed, dex, intel, health, maxhealth, gender from players where user='$user'";
$result=mysql_query($query);
if (!$result)
{
die (mysql_error());
}

$num_rows=mysql_num_rows($result);

echo "$query";

?>

<HTML>
<HEAD>
<style type="text/css" media="all">
        @import "css.php";
    </style>
    <TITLE>TWOTTK.COM</TITLE>
</HEAD>
<TABLE width=100% border=0 cellpadding=0 cellspacing=0>
<TR>
    <TD colspan=5>
        <p align="center">
        <img src="http://www.twottk.com/game/banner.jpg" width="730" height="160"></p>
        <TABLE border=0 cellpadding=0 cellspacing=0>
            <TR><TD>
              
              </TD></TR>
        </TABLE>
    </TD>
</TR>
<TR height=20><TD colspan=5 align=left><!-- SPACER --></TD></TR>
<TR>
    <TD align=left width=5><!-- SPACER --></TD>
    <TD align=left WIDTH=20% valign=top>
        <TABLE border=0 cellpadding=0 cellspacing=0 height="85" width="164">
        <TR>
            <TD colspan=2 width=164 height="17"><hr></TD>
        </TR>
        <TR>
        <?php
require_once('cssloggedin.php');
$row=mysql_fetch_array($result);


$playerid=($row['playerid']);
$user=($row['user']);
$fatigue=($row['fatigue']);
$maxfat=($row['maxfat']);
$power=($row['power']);
$speed=($row['speed']);
$dex=($row['dex']);
$intel=($row['intel']);
$health=($row['health']);
$maxhealth=($row['maxhealth']);
$gender=($row['gender']);
?>

                    <TR>
            <TD colspan=2 width=164 height="30">
            Game Stats:<br>
        ID:
           <?php
        echo "$playerid";
        ?><br>
        Gender:
        <?php
           echo "$gender";
        ?><br>
            Health: 
            <?php
            echo "$health / $maxhealth";
            ?><br>
            Fatigue:
            <?php
            echo "$fatigue / $maxfat";
            ?><hr>
            <p><hr>Navigation:<br>
            <a href="home.php">Home</a><br>
<a href="town.php">Town</a>
<br>
Account<br>
<a href="logout.php">Logout<br></a>
&nbsp;<hr></p>
            <hr></TD>
        </TR>

        <TR height=20>
            <TD height="1" width="164"><!-SPACER-></TD>
        </TR>

        <TR>
            <TD colspan=2 width=164 height="1">
            </TD>
        </TR>
        <TR>
            <TD width=164 bgcolor=#FFFFFF valign=top height="12"><samp>Logged 
            In: 
            <?php
            echo date ('jS F'); ?><p></samp></TD>
            <TD width=1 bgcolor=#FFFFFF height="12"></TD>
        </TR>
        <TR>
            <TD colspan=2 width=164 height="12">
<hr>            </TD>
        </TR>
        </TABLE>

        <BR>

    </TD>

    <TD align=left width=1%><!-- SPACER --></TD>

    <TD align=left WIDTH=78% valign=top>
    <TABLE width=744 border=0 cellpadding=0 cellspacing=0 height="12">
            <TR>
                <TD valign=top align=left width=4 height="12"></TD>
                <TD valign=top align=center background=templates/default/images/menuback.gif width="736" height="12"><hr></TD>
                <TD valign=top align=right width=4 height="12"></TD>
            </TR>
        </TABLE><TABLE width=740 border=0 cellpadding=0 cellspacing=0>
            <TR>
                <TD width=1 bgcolor=#FFFFFF></TD>
                <TD bgcolor=#FFFFFF width="733" >
                <p align="center">
                <img src="http://www.twottk.com/game/character.jpg" width="105" height="200"></p>
                <div id="gamestats">
           <?php
echo "<b>Character Stats:</b><br /><br />Power: $power <br /> Speed: $speed <br /> Dexterity: $dex <br /> Inteligence: $intel"; 

?></div>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                <p>&nbsp;</TD>
            </TR>
        </TABLE>
        <p>&nbsp;</p>
        <TABLE width=748 border=0 cellpadding=0 cellspacing=0 height="39">
            <TR>
                <TD valign=top align=left width=4 height="39">&nbsp;</TD>
                <TD align=center background=templates/default/images/menu_bottom.gif width="740" height="39"><hr></TD>
                <TD valign=top align=right width=4 height="39">&nbsp;</TD>
            </TR>
        </TABLE>
        <br><CENTER>

        <p></p>

        </CENTER>
    </TD>
    <TD align=left width=10><!-- SPACER --></TD>
</TR>
</TABLE>


</BODY>

</HTML>

thats the code. now the problem is the:

        <TR>
            <TD colspan=2 width=164 height="30">
            Game Stats:<br>
        ID:
           <?php
        echo "$playerid";
        ?><br>
        Gender:
        <?php
           echo "$gender";
        ?><br>
            Health: 
            <?php
            echo "$health / $maxhealth";
            ?><br>
            Fatigue:
            <?php
            echo "$fatigue / $maxfat";
            ?><hr>

this and all other parts like this do not show up the $health etc when the file is uploaded. now i have a login which takes me to the exact same page as this and that works fine now i cant understand why this isnt :S.

go to

www.twottk.com/game

signup login and click home to see what i mean.

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 18 April 2006 - 12:46 AM

Well, displaying the query was very helpful:

select playerid, user, email, fatigue, maxfat, power, speed, dex, intel, health, maxhealth, gender from players where user=''

As you see, user='', it's empty. Your script is not recording the user id.
~ D Kuang

#3 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 18 April 2006 - 10:05 AM

[!--quoteo(post=365787:date=Apr 17 2006, 07:46 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Apr 17 2006, 07:46 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Well, displaying the query was very helpful:

select playerid, user, email, fatigue, maxfat, power, speed, dex, intel, health, maxhealth, gender from players where user=''

As you see, user='', it's empty. Your script is not recording the user id.
[/quote]

any idea on how to sort it? i do have something after that, as you can see from the code :S



#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 18 April 2006 - 11:02 AM

somewhere before your query define $user.

Is this taken from a session variable? if so $user = $_SESSION['user']

What ever is holding the value you need assign it to $user and it should be fine.
follow me on twitter @PHPsycho

#5 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 18 April 2006 - 04:15 PM

yeah thanks, i got it sorted now :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users