Donbudz Posted November 14, 2008 Share Posted November 14, 2008 Hope im posting in right forum.....anyways here goes... Ok, i found a example im trying to get to work in my favor. So far no luck. Not working for me. Plus PHP maybe trying to show more then I need. I have a table named: "users_online", with a field: "usersonline" I want to show all rows in my field in dynamic text box. No special order is needed, the field does need to update itself. Here is my PHP code: <? $server = "localhost"; $user = "dbusername"; $pass = "dbpassword"; $database = "dbname"; $tableName = "users_online"; $conn = @mysql_connect($server,$user,$pass); $database = @mysql_select_db($database,$conn); $query = @mysql_query("SELECT * FROM $tableName ORDER BY posted desc"); $total_rows = @mysql_num_rows($query); $counter = 0; while($users = @mysql_fetch_array($query)){ $id = $$users["id"]; $title = $$users["title"]; $body = $$users["body"]; $posted = strftime("%d-%m-%y", $myNewsData['posted']); $counter++; print("&users_data$counter=$id|$title|$body|$posted"); } print("&total=$total_rows"); ?> Flash code, Frame action: var receiver:LoadVars = new LoadVars(); news_txt.htmlText = "loading users data..."; receiver.onLoad = function(ok){ if(ok){ news_txt.htmlText = ""; for(var i =1;i<=receiver.total;i++){ receiver["dataPacket"+i] = receiver["users_data"+(i)].split("|"); var _id:String = receiver["dataPacket"+i][0]; var _title:String = receiver["dataPacket"+i][1]; var _body:String = receiver["dataPacket"+i][2]; var _posted:String = receiver["dataPacket"+i][3]; delete(receiver["news_data"+i]); news_txt.htmlText += (_title + "<br/>" + _body + "<br/>" + _posted + "<br/><br/>") } }else{ news_txt.htmlText = "no users data was found!"; } } receiver.sendAndLoad("http://www.mydomain.com/users_online.php"); I need to display all the rows from one field, not real sure how to edit the code for that. Could someone review the PHP and Fla code for me? Im not real sure what part is not working. Heres file/table/instance names etc..... Tablename: "users_online" Fieldname: "usersonline" PHP: "users_online.php" SWF: "show_usersonline.swf" Dynamictext Instance Name: "news_txt" (multiline,render as HTML) Any Help would be greatly appreciated!! Link to comment https://forums.phpfreaks.com/topic/132720-solved-retreiving-table-dataflash/ Share on other sites More sharing options...
Donbudz Posted November 15, 2008 Author Share Posted November 15, 2008 I edited the two scripts best i could: PHP: <? $server = "myserver"; $user = "dbusername"; $pass = "dbpassword"; $database = "dbname"; $tableName = "users_online"; $conn = @mysql_connect($server,$user,$pass); $database = @mysql_select_db($database,$conn); $query = @mysql_query("SELECT * FROM $tableName ORDER BY posted desc"); $total_rows = @mysql_num_rows($query); $counter = 0; while($myNewsData = @mysql_fetch_array($query)){ $users = $myNewsData["usersonline"]; print("&users_data$counter=$users"); } print("&total=$total_rows"); ?> Flash code: var receiver:LoadVars = new LoadVars(); users_txt.htmlText = "loading users data..."; receiver.onLoad = function(ok){ if(ok){ news_txt.htmlText = ""; for(var i =1;i<=receiver.total;i++){ receiver["dataPacket"+i] = receiver["users_data"+(i)].split("|"); var _users:String = receiver["dataPacket"+i][0]; users_txt.htmlText = ("_users") } }else{ users_txt.htmlText = "no users was found!"; } } receiver.sendAndLoad("http://www.mysite.com/users_online.php"); Just trying to get flash to show all rows in one field in the table. (just usernames) Of course i still cant get it to work. Any suggestions? table:"users_online" field:"usersonline" dynamic field instance:"users_txt" show_usersonline.swf users_online.php Link to comment https://forums.phpfreaks.com/topic/132720-solved-retreiving-table-dataflash/#findComment-690922 Share on other sites More sharing options...
Donbudz Posted November 18, 2008 Author Share Posted November 18, 2008 i cant seem to get a response here, im moving on. peace Link to comment https://forums.phpfreaks.com/topic/132720-solved-retreiving-table-dataflash/#findComment-692530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.