Small rant....
Your coding needs work. Take a look at this. Not saying it's right, but it's to a standard. Indention. Seperate variables from strings every time. You use double quotes, and single quotes in your arrays. Pick one, and stick with it. Just take a look, try to code to some standard. Doesn't have to be mine, but some standard. And indention is in every standard.
Ok, enough rant, on to the code. I can't say exactly what is wrong here. But here is how you go about thoroughly debugging your code. Notice all the extra exho statements. This will show you where you're going wrong. Give it a shot.
<?
error_reporting(E_ALL);
if($_POST['buy']) {
$stocktotal=$st['total'];
echo "Stocktotal: ".$stocktotal."<br>";
$total= ($shares * $stocktotal);
echo "Shares: ".$shares."<br>Total: ".$total."<br>";
$sql="SELECT * FROM users WHERE username='".$uname."'";
echo "SQL 1: ".$sql."<br>";
$result=mysql_query($sql);
$myrow=mysql_fetch_array($result);
echo "Aura: ".$myrow['aura']."<br>";
echo "String Aura: ".$aura."<br>";
if($myrow['aura'] < $total) {
echo "<tr>
<td colspan=\"3\" class=\"sys\" align=\"center\">You don't have enough ".$aura." to purchase "".stripslashes($shares)."" share(s).</td>
</tr>";
}
elseif($shares< 0) {
echo "<tr>
<td colspan=\"3\" class=\"sys\" align=\"center\">You cannot buy 0 shares.</td>
</tr>";
}
else {
$auratotal = ($myrow['aura'] - $total);
echo "Aura Total: ".$auratotal."<br>";
$stocktotal2 = ($st['total'] + $shares);
echo "Stock Total 2: ".$stocktotal2."<br>";
$sharenumber = ($st['shares'] + $shares);
echo "Share Number: ".$sharenumber."<br>";
unset($sql);
$sql="UPDATE users SET aura = ".$auratotal." WHERE username = '".$uname."'";
echo "SQL 2: ".$sql;
mysql_query($sql);
unset($sql);
$sql="UPDATE stocks SET total = '".$stocktotal2."'";
echo "SQL 3: ".$sql;
mysql_query($sql);
unset($sql);
$sql="UPDATE stocks SET shares = '".$sharenumber."'";
echo "SQL 4: ".$sql;
mysql_query($sql);
unset($sql);
$sql="UPDATE users SET stockname = '".$st['name']."'";
echo "SQL 5: ".$sql;
mysql_query($sql);
echo "<tr>
<td colspan=\"3\" class=\"sys\" align=\"center\">Your shares have been purchased.</td>
</tr>";
}
}
?>