greens85 Posted June 20, 2008 Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111113-echoing-php-queries-into-flash/ Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 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); } Quote Link to comment https://forums.phpfreaks.com/topic/111113-echoing-php-queries-into-flash/#findComment-570189 Share on other sites More sharing options...
greens85 Posted June 20, 2008 Author Share Posted June 20, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/111113-echoing-php-queries-into-flash/#findComment-570224 Share on other sites More sharing options...
MadTechie Posted June 20, 2008 Share Posted June 20, 2008 <?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; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/111113-echoing-php-queries-into-flash/#findComment-570238 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.