Amount not showing up on site..
Posted: Thu Oct 16, 2003 9:01 pm
I am attempting to make a site where it is a website-game, and the gold after you log in won't show up...unless I run it to update through the login process, but it won't update the amount until they log in again. Therefore I need to add the script into the index page to auto update the gold as it increases and decreases. Here is my code:
Code: Select all
<?php session_start(); ?>
<html>
<head>
<title>.: Test Document :..: Home :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$dbname = "random";
$dbpass = "random";
$db = "random";
$link = mysql_connect(localhost, $dbname, $dbpass);
$sdb = mysql_select_db($db, $link);
$result = mysql_query("SELECT uid FROM users WHERE uname = $_SESSIONї'username']");
$row = mysql_fetch_array($result);
$uid = $rowї'0'];
$mgold = mysql_query("SELECT gold FROM user_info WHERE uid = $uid");
$gold = mysql_fetch_array($mgold);
$_SESSIONї'gold'] = $goldї'0'];
$final = $goldї'0'];
?>
<style type="text/css">
body{background-color:"#626262";color:"#CCCCCC";font-style:"arial";size:"10";}
</style>
<br>
<br>
<br>
<div align="center"> </div>
<table width="978" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="100" colspan="4" valign="top"><center>
<img src="images/title.jpg" width="400" height="100" border="0" usemap="#Map3">
</center></td>
<td width="1"></td>
</tr>
<tr>
<td width="150" rowspan="2" valign="top"><p><img src="images/register.jpg" width="150" height="50" border="0" usemap="#Map"><img src="images/login.jpg" width="150" height="50" border="0" usemap="#Map2">
</p></td>
<td height="100" colspan="3" valign="top"><!--DWLayoutEmptyCell--> </td>
<td></td>
</tr>
<tr>
<td width="100" rowspan="2" valign="top"><!--DWLayoutEmptyCell--> </td>
<td width="477" rowspan="2" valign="top"><div align="center">
<p>Scripting Phase.. (10-15-2003)<br>
By Mooksman</p>
<p align="left">Scripting has just started, as you can see the site is
quite bare. We will be scripting the simple stuff first, as in login,
register, etc. until the mySQL databases are properly fit to suit my
wants..er, needs :). </p>
<p align="left">Thanks,<br>
Admin Mooksman <Webmaster></p>
<p> </p>
</div></td>
<td width="250" rowspan="2" valign="top"><!--DWLayoutEmptyCell--> </td>
<td height="180"></td>
</tr>
<tr>
<td height="29" align="center" valign="middle">
<div align="center"><font size="-1">Currently logged in as:<br>
<font color="#00CC00"><?php echo $_SESSIONї'username']; ?></font><br>
<font size="-1">Gold: <font color="#00CC00"><?php echo "$final"; ?></font></div></td>
<td></td>
</tr>
</table>
<map name="Map">
<area shape="rect" coords="2,1,149,49" href="/register.php" alt="Register">
<area shape="rect" coords="3,49,146,97" href="/register.php">
</map>
<map name="Map2">
<area shape="rect" coords="1,1,152,51" href="/login.php" alt="Login">
</map>
<map name="Map3">
<area shape="rect" coords="1,2,399,99" href="#">
</map>
</body>
</html>