Resource id #2

$asdf = “select cash from usergame where user_name = ‘$HTTP_SESSION_VARS[user_name]’” or die(mysql_error());
$asdf_res = mysql_query($asdf) or die(mysql_error());
srand ((float) microtime() * 10000000);
while ($cats = mysql_fetch_array($asdf_res)) {
$cash = $cats[‘cash’];

When i try and select cash … cash =0 when it should = something else
I know it finds the row because i put print $cash in that while statement and it prints as 0
Resource id #2
i get that stupid error and i donno why i think thats whats causing cash to not = what it should… help me out eh?

I get this problem too. It normally means your trying to print an SQL query. but that dosen’t look like the case. I would recommend trying to remove as much logic as you can (ie loops etc) and work your way down until you find the problem. Maybe with a little more code I could help you out.

<?
session_start();
$conn = mysql_connect(“localhost”, “Oldschooljdb”, “xxxx”);
mysql_select_db(“Berone”,$conn);
$asdf = “select cash from usergame where user_name = ‘$HTTP_SESSION_VARS[user_name]’” or die(mysql_error());
$asdf_res = mysql_query($asdf) or die(mysql_error());
srand ((float) microtime() * 10000000);
while ($cats = mysql_fetch_array($asdf_res)) {
$score = $_POST[‘score’];
$gold = $cats[“cash”];

print “status=$gold”;
echo $HTTP_SESSION_VARS[‘user_name’];
$gold = $gold + $score;
print “$asdf_res”;
$q = “update usergame set cash =’$gold’ where user_name =’$HTTP_SESSION_VARS[user_name]’”;
$result = mysql_query($q) or die(mysql_error());

}

// $gold = $gold + $score;

/*
$sql = “select * from score where game = ‘$game’”;
$sql_res = mysql_query($sql,$conn) or die(mysql_error());
srand ((float) microtime() * 10000000);
while ($stats = mysql_fetch_array($sql_res)) {
$score2 = $stats[‘score’];
if ($score > $score2) {
$id = mysql_insert_id();
$sql = “insert into score values (’$id’, ‘$HTTP_SESSION_VARS[user_name]’, ‘$score’, ‘$game’)”;
$resu = mysql_query($sql, $conn);
$deletion = “delete from score where score = ‘$score2’ and game = ‘$game’”;

      mysql_query($deletion) or die (mysql_error());

}

}
*/

?>

<?
session_start();
$conn = mysql_connect(“localhost”, “Oldschooljdb”, “xxx”);
mysql_select_db(“Berone”,$conn);
$asdf = “select cash from usergame where user_name = ‘$HTTP_SESSION_VARS[user_name]’” or die(mysql_error());
$asdf_res = mysql_query($asdf) or die(mysql_error());
srand ((float) microtime() * 10000000);
while ($cats = mysql_fetch_array($asdf_res)) {
$gold = $cats[“cash”];

print “status=$gold”;
}
?>

i shortened it to that…
is the fact that im using this with actionscript making a different…
i use this to select there cash add score to it and then update it back

i figured it out! when i start my game it automatically puts your cash to 0 for some reason and i donno how? at all

help new topic lol