PDA

View Full Version : i need help with this peice of coding


trojanbobba
10-26-2002, 11:49 PM
ok i need help with this peice of coding shown below:

<?php
session_start();
echo '
<center><u>'.$user.'`s Info</center></u><left><br><br>
&nbsp;Name:'.$user.'<br>
&nbsp;Dollar:'.$dollar.'<br>
&nbsp;Tokens: '.$tokens.'<br><br><br><u><center>Quick Links</center></u><br><br>&nbsp;<a href="house.php">'.$user.'`s House</a><br><Br><br>&nbsp;<a href="logout.php">Logout</a>
<td width="83%" valign="top"><font face="tahoma" size="1">Game ID: '.$id.'</td>

wat i need help with is only the '.$user.' is showing the $dollar etc is not showing i cant seem to fix it and i dont know wat is up so if u can could u help me thanx :thumbsup:

Nightfire
10-27-2002, 12:48 AM
How are you getting these values? from the session? if it's from the session, are you putting all the info into the session? are you using a db to get the info? is it straight from a form?

trojanbobba
10-27-2002, 12:51 AM
rite well u see i got '.$user.' working so on the site it look like blah's info k and under it i have dollar etc but they dont seem to have dollar 100 etc get wat i mean ???

u see only the user's name is showing nothing else its hard to explain goto http://members.lycos.co.uk/gapa2002 sign up then log in and u will see wat i mean *hopefully*

mordred
10-27-2002, 01:35 AM
Can't you provide a little more information on your problem or post the relevant code, because your signup page is constantly inaccesible due to the ad displayed over your form (*very* annoying)?

Of course, telling us from where the $user variable gets its value would also help a lot.

trojanbobba
10-27-2002, 01:38 AM
ok here is the full html code and the php code k

-------------------------------------------------------------------
<html>
<head>
<title>ReliksAA</title>
</head>
<body bgcolor="black" text="black" alink="black" vlink="black" link="black">
<CENTER>
<table width="75%" border="1" cellspacing="0" cellpadding="0" bgcolor="gray" bordercolor="black">
<tr>
<td width="17%" align="center" height="19"><font face="Tahoma" size="1">ReliksAA.com</font></td>
<td width="83%" align="center" height="19"><font face="Tahoma" size="1">Welcome
to Reliks Adoption Agency.</font></td>
</tr>
</table>
<table width="75%" border="1" cellspacing="0" cellpadding="0" height="368" bgcolor="gray" bordercolor="black">
<tr>
<td width="17%" valign="top" div align="left"><font face="tahoma" size="1">

<?php
session_start();
echo '
<center><u>'.$user.'`s Info</center></u><left><br><br>
&nbsp;Name:'.$user.'<br>
&nbsp;Dollar:'.$dollar.'<br>
&nbsp;Tokens: '.$tokens.'<br><br><br><u><center>Quick Links</center></u><br><br>&nbsp;<a href="house.php">'.$user.'`s House</a><br><Br><br>&nbsp;<a href="logout.php">Logout</a>
<td width="83%" valign="top"><font face="tahoma" size="1">Game ID: '.$id.'</td>
</tr>
</table>
<table width="75%" border="1" cellspacing="0" cellpadding="0" bgcolor="gray" bordercolor="black">
<tr>
<td div align="center" height="19"><font face="Tahoma" size="1">Copyright©
2002-2003 ReliksAA.com All right reserved</font> </td>
</tr>
</table>
</CENTER>
';
?>
</body>
</html>

-------------------

dont ask where the $user is coming from i have been looking for a while and i gave up :/

trojanbobba
10-27-2002, 01:41 AM
all the user etc is in the members table on the database but i dont see a mysql connect or anything there so i dunno how its getting it :confused:

mordred
10-27-2002, 10:06 AM
Try


var_dump($HTTP_SESSION_VARS);


and see if it's coming from the session.

trojanbobba
10-27-2002, 02:46 PM
ok i did that all i get back is summit bought array(5) ['user'] = trojan stuff like that :-/ i think the $user might be coming from that. i have tried

include('database.php')
$sql = "SELECT * FROM members WHERE user="$user";

but nothing happens maybe its from the session in the login section i dunno if i should put at the end of the login.php session_destroy();

Nightfire
10-27-2002, 02:50 PM
$sql = "SELECT * FROM members WHERE user='$user'";
$result = mysql_query($sql);

trojanbobba
10-28-2002, 12:33 AM
hey i tried this coding but i keep getting parse error on line 27


<?php
session_start();
require('database.php');
$sql = mysql_query("SELECT * FROM members WHERE email='$email'");
$data = mysql_fetch_array($sql);
print "$data[user] info";
print "&nbsp;Name: $data[user]";
print "&nbsp;Dollar: $data[dollar]";


print "$data[user] info"; <---- this is line 27 i dont see anything wrong with it do u??? :confused:

Nightfire
10-28-2002, 02:00 AM
Give this a try:

<?php
session_start();
require('database.php');
$sql = mysql_query("SELECT * FROM members WHERE email='$email'");
$data = mysql_fetch_array($sql);
echo ''.$data[user].' info';
echo ' Name: '.$data[user].'';
echo ' Dollar: '.$data[dollar].'';

trojanbobba
10-28-2002, 02:07 AM
well i tried it but no luck damb i cant figure out why this is not working

trojanbobba
10-28-2002, 02:15 AM
$data = mysql_fetch_array($sql); <---- this line lol never works :mad:

trojanbobba
10-28-2002, 05:06 PM
:p i got house to work ;) i am making a bank does anyone know how to start one???:rolleyes: