cnl83 Posted March 14, 2006 Share Posted March 14, 2006 This script is for Flash, but it works cause I tested it out. All im doing is pulling the record for the current user. Basically, just the name for now. The problem I have is that, it is pulling the first record int he DB. Im still a noob, and if someone could help with this code, that would be awesome.[code]<?include ('Include.inc');require ('/home/apex/scormsource-www/'."/classes/access_user/access_user_class.php");$page_protect = new Access_user;// $page_protect->login_page = "login.php"; // change this only if your login is on another page$page_protect->access_page(); // only set this this method to protect your pageif (isset($_GET['action']) && $_GET['action'] == "log_out") { $page_protect->log_out(); // the method to log off}//stuff for FLASHmysql_connect($DBhost,$DBuser,$DBpass);@mysql_select_db("$DBName");$mid=$mid-1;$query = "SELECT * FROM users";$result = mysql_query($query);$real_name = mysql_result($result,0,"real_name");//$one = mysql_result($result,0,"one");print "&real_name=$real_name";//print "&one=$one";print "&status=DONE.";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4985-sorting-record-by-current-user/ Share on other sites More sharing options...
hitman6003 Posted March 14, 2006 Share Posted March 14, 2006 Change:[code]$real_name = mysql_result($result,0,"real_name");//$one = mysql_result($result,0,"one");print "&real_name=$real_name";//print "&one=$one";[/code]to:[code]for ($i = 0; $i < mysql_num_rows($result); $i++) { print "&real_name=" . mysql_result($result,$i,"real_name");}[/code]You may have to add in a "\n" or something along those lines for flash to intrepret each one seperatly. Quote Link to comment https://forums.phpfreaks.com/topic/4985-sorting-record-by-current-user/#findComment-17581 Share on other sites More sharing options...
cnl83 Posted March 14, 2006 Author Share Posted March 14, 2006 [!--quoteo(post=355111:date=Mar 14 2006, 10:59 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 14 2006, 10:59 PM) [snapback]355111[/snapback][/div][div class=\'quotemain\'][!--quotec--]Change:[code]$real_name = mysql_result($result,0,"real_name");//$one = mysql_result($result,0,"one");print "&real_name=$real_name";//print "&one=$one";[/code]to:[code]for ($i = 0; $i < mysql_num_rows($result); $i++) { print "&real_name=" . mysql_result($result,$i,"real_name");}[/code]You may have to add in a "\n" or something along those lines for flash to intrepret each one seperatly.[/quote]Thank you for your reply...Im not trying to read all the records at one time though. Im trying to read the record for the current user. Quote Link to comment https://forums.phpfreaks.com/topic/4985-sorting-record-by-current-user/#findComment-17589 Share on other sites More sharing options...
keeB Posted March 14, 2006 Share Posted March 14, 2006 change [code]$query = "SELECT * FROM users";[/code]to[code]$query = "SELECT * FROM users WHERE login = '<userlogin>' ";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4985-sorting-record-by-current-user/#findComment-17594 Share on other sites More sharing options...
cnl83 Posted March 14, 2006 Author Share Posted March 14, 2006 [!--quoteo(post=355124:date=Mar 14 2006, 11:27 PM:name=keeB)--][div class=\'quotetop\']QUOTE(keeB @ Mar 14 2006, 11:27 PM) [snapback]355124[/snapback][/div][div class=\'quotemain\'][!--quotec--]change [code]$query = "SELECT * FROM users";[/code]to[code]$query = "SELECT * FROM users WHERE login = '<userlogin>' ";[/code][/quote]Ok thanks...where are you getting <userlogin>? Quote Link to comment https://forums.phpfreaks.com/topic/4985-sorting-record-by-current-user/#findComment-17598 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.