I have been playing with PHP to design a basic website that I want to use to keep track of a virtual casino's "credits." However, I am stuck at a problem. I have a table called 'light' with the columns 'username', 'credits', and 'last_mod'. I can get the following page to echo the username and credits values of a certain row, but not the last_mod value. I am not sure why.
Any help would be appreciated!
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Lookup</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Account Lookup</h1>
<a href="member-index.php">Back to Index</a> | <a href="lookup.php">Back to Lookup</a> | <a href="logout.php">Logout</a>
<?php
include 'opendb.php';
if(!get_magic_quotes_gpc())
{
$Username = mysql_real_escape_string($_POST['username']);
$acctType = mysql_real_escape_string($_POST['acctType']);
}
else
{
$Username = $_POST['username'];
$acctType = $_POST['acctType'];
}
$qry = "SELECT credits FROM $acctType WHERE username='$Username'";
$result = mysql_query($qry);
if (mysql_num_rows($result)==0)
{
echo "<p><font size='+1' color='red'>$Username does not have a $acctType LEGACY account - remember that the database is CaSe
SeNsItIvE</font></p><p><a href='lookup.php'>Try Again</a>";
}
else
{
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC))
{
echo $row['last_mod'];
if (($acctType == 'light') && ($row['credits'] < 1))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account.";
}
else if (($acctType == 'gambler') && ($row['credits'] < 15))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account. A Gambler account closure will take a 5-credit fee, and any remaining credits will then be returned to his or her donations room.";
}
else if (($acctType == 'high_roller') && ($row['credits'] < 150))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account. A High Roller account closure will take a 10-credit fee, and any remaining credits will then be returned to his or her donations room.";
}
else
{
$output = "";
}
echo "<p><font size='+1'>Current LEGACY Credits on " . $Username . ": " . $row['credits'] . "</font><img src='http://www.habbo.com/habbo-
imaging/avatarimage?user=" . $Username . "&action=&direction=4&head_direction=4&gesture=&size=l' alt='" . $Username . " avatar'></p><p>" .
$output . "</p><p> </p><p>If you would like to modify this, please enter the new amount here:</p><p><form id='modify' name='modify'
method='post' action='mod.php'><input name='newAmount' type='text' class='textfield' id='newAmount' /><input name='acctType' type='hidden'
id='acctType' value='" . $acctType . "' /><input name='username' type='hidden' id='username' value='" . $Username . "' /><input name='submit'
type='submit' id='submit' value='Modify' /></form></p>";
}
}
include 'closedb.php';
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Lookup</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Account Lookup</h1>
<a href="member-index.php">Back to Index</a> | <a href="lookup.php">Back to Lookup</a> | <a href="logout.php">Logout</a>
<?php
include 'opendb.php';
if(!get_magic_quotes_gpc())
{
$Username = mysql_real_escape_string($_POST['username']);
$acctType = mysql_real_escape_string($_POST['acctType']);
}
else
{
$Username = $_POST['username'];
$acctType = $_POST['acctType'];
}
$qry = "SELECT credits FROM $acctType WHERE username='$Username'";
$result = mysql_query($qry);
if (mysql_num_rows($result)==0)
{
echo "<p><font size='+1' color='red'>$Username does not have a $acctType LEGACY account - remember that the database is CaSe
SeNsItIvE</font></p><p><a href='lookup.php'>Try Again</a>";
}
else
{
while ($row = mysql_fetch_array ($result, MYSQL_ASSOC))
{
echo $row['last_mod'];
if (($acctType == 'light') && ($row['credits'] < 1))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account.";
}
else if (($acctType == 'gambler') && ($row['credits'] < 15))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account. A Gambler account closure will take a 5-credit fee, and any remaining credits will then be returned to his or her donations room.";
}
else if (($acctType == 'high_roller') && ($row['credits'] < 150))
{
$output = "Inform the bettor that his or her account balance has fallen below the minimum. This occurred at " . $row['last_mod'] . ", and the
bettor has three business days to refill his or her account after this date before it will be automatically closed. This means that if the below-
minimum status of the account occurred on October 3, he or she would have until the casino closes on October 6 to add more to his or her
account. A High Roller account closure will take a 10-credit fee, and any remaining credits will then be returned to his or her donations room.";
}
else
{
$output = "";
}
echo "<p><font size='+1'>Current LEGACY Credits on " . $Username . ": " . $row['credits'] . "</font><img src='http://www.habbo.com/habbo-
imaging/avatarimage?user=" . $Username . "&action=&direction=4&head_direction=4&gesture=&size=l' alt='" . $Username . " avatar'></p><p>" .
$output . "</p><p> </p><p>If you would like to modify this, please enter the new amount here:</p><p><form id='modify' name='modify'
method='post' action='mod.php'><input name='newAmount' type='text' class='textfield' id='newAmount' /><input name='acctType' type='hidden'
id='acctType' value='" . $acctType . "' /><input name='username' type='hidden' id='username' value='" . $Username . "' /><input name='submit'
type='submit' id='submit' value='Modify' /></form></p>";
}
}
include 'closedb.php';
?>
</body>
</html>