# Resource id #2

**URL:** <https://forum.kirupa.com/t/resource-id-2/57190>\
**Category:** flash\
**Created:** [July 11, 2004, 6:03am UTC](https://forum.kirupa.com/t/resource-id-2/57190 "2004-07-11T06:03:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Berone](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Berone](https://forum.kirupa.com/u/Berone)\
**Post date:** [July 11, 2004, 6:03am UTC](https://forum.kirupa.com/t/resource-id-2/57190/1 "2004-07-11T06:03:20Z")

</div>

$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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 6:20am UTC](https://forum.kirupa.com/t/resource-id-2/57190/2 "2004-07-11T06:20:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 5:51pm UTC](https://forum.kirupa.com/t/resource-id-2/57190/3 "2004-07-11T17:51:29Z")

</div>

\<?  
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());

```

}

}  
\*/

?\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 5:58pm UTC](https://forum.kirupa.com/t/resource-id-2/57190/4 "2004-07-11T17:58:33Z")

</div>

\<?  
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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2004, 6:06pm UTC](https://forum.kirupa.com/t/resource-id-2/57190/5 "2004-07-11T18:06:36Z")

</div>

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
