# Question about relational database with as3

**URL:** <https://forum.kirupa.com/t/question-about-relational-database-with-as3/332632>\
**Category:** flash\
**Created:** [August 28, 2014, 10:42pm UTC](https://forum.kirupa.com/t/question-about-relational-database-with-as3/332632 "2014-08-28T22:42:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serifaz](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@Serifaz](https://forum.kirupa.com/u/Serifaz)\
**Post date:** [August 28, 2014, 10:42pm UTC](https://forum.kirupa.com/t/question-about-relational-database-with-as3/332632/1 "2014-08-28T22:42:19Z")

</div>

Hey all.  
I am trying to see if I can get some info on a script I put togeather to gather information out of one mysql table based on an id that another table has.

my current php file is

```php
<?php
include "connect.php";
include "config.php";

if($_POST["sendRequest"] == "getStats"){
    $user_id = ("SELECT user_id FROM '$tableStats'");
    $id = ("SELECT id FROM '$tableNames'"); 
    $getStamina = mysql_query("SELECT stamina FROM '$tableStats' WHERE '$user_id' = '$id'");
    $row1 = mysql_fetch_array($getStamina);
    print "stamina=$row1[stamina]";
} ?>

```

and my current actionscript on the timeline is essentially requesting what is in the if statement, after the user loggs in

```php
import flash.display.MovieClip
import flash.events.MouseEvent
import flash.net.*

var d = (this.parent as MovieClip).userInfo
var current_user_id:int
var stamina:Number
var variables:URLVariables = new URLVariables
var staminaVar:URLVariables = new URLVariables
var varGetStamina:URLRequest = new URLRequest("php/user_stats.php")

varGetStamina.method = URLRequestMethod.POST
varGetStamina.data = staminaVar
var staminaVarLoader:URLLoader = new URLLoader  
staminaVarLoader.dataFormat = URLLoaderDataFormat.VARIABLES
staminaVarLoader.addEventListener(Event.COMPLETE, completeHandler2)
staminaVar.user_id = current_user_id
staminaVar.sendRequest = "getStats"
staminaVarLoader.load(varGetStamina)

function completeHandler2(event:Event):void {
	stamina = event.target.data.stamina
	output_stamina_txt.text = "stamina " + stamina
}

```

I have two tables one is user\_accounts, the other is user\_stats.  
I am trying to get the information in user\_stats based on the field user\_id that matches the id in my user\_accounts.  
so when the user logs in it will let them view there stats.

I keep getting a NaN value or a 0 . not sure how to fix this. any suggestions or advice welcome.  
I am kinda new to this so be gentle. 😛
