Jump to content

Echoing PHP Queries Into Flash


greens85

Recommended Posts

Hi All,

 

I have the following code in PHP.

 

function login($username,$pass) 
{ 
   GLOBAL $db,$table; 
   $username = trim($username); 
   $pass = md5(trim($pass)); 
           $query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'"); 
               return mysql_num_rows($query); 
}

 

Inside the database i have the following fields:

 

userID

userName

userPassword

userMail

userQuestion

userAnswer

userBalance

 

I realise that the query is selecting all these fields from the database, but what i want to be able to do is show the value of userBalance in a dynamic text field inside of Flash.

 

Can anyone suggest how i might be able to go about this?

 

Also i should metion that the code also checks if the users login details are correct, not sure if this affects my ability to alter the PHP code.

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/111113-echoing-php-queries-into-flash/
Share on other sites

This is really a flash question i think..

but to echo the results just do

 

function login($username,$pass) 
{ 
   GLOBAL $db,$table; 
   $username = trim($username); 
   $pass = md5(trim($pass)); 
           $query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'"); 
           $row = mysql_fetch_assoc($query)
           echo $row['userBalance'];
               return mysql_num_rows($query); 
}

If i echo the userBalance in this way, would this affect the way the existing code operates. I.E. I need this code not only to check what a particular users balance is and display the correct amount in flash but also to check if the the login details the user has entered are correct?

 

Thanks for your help

<?php
function login($username,$pass) 
{ 
   GLOBAL $db,$table; 
   $username = trim($username); 
   $pass = md5(trim($pass));
   $query = mysql_query("SELECT * FROM $table WHERE userName = '$username' AND userPassword = '$pass'"); 
   $count = mysql_num_rows($query);
   if($count == 0) return $count;
   $row = mysql_fetch_assoc($query)
   echo $row['userBalance'];
   return $count; 
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.