scottiescotsman Posted March 3, 2014 Share Posted March 3, 2014 (edited) I have a table named download_manager, with id, FILE & DOWNLOADS columns. All I want to do is view in FLASH MovieClip the downloads column of the row with the id I specify. Will this achieve this ? <?php error_reporting(E_ALL^E_NOTICE); require('connect.php'); $body=""; $result = mysqli_query("SELECT * FROM download_manager WHERE id = 'xx'"); $data = mysqli_fetch_assoc($result); $result->close(); $body = '<b><font name="Teen" color="#009999" size="11">' . $data['DOWNLOADS'] . '</font></b> '; echo "returnBody=$body"; exit(); ?> Thanks for your help Steven Edited March 3, 2014 by Zane Quote Link to comment Share on other sites More sharing options...
requinix Posted March 3, 2014 Share Posted March 3, 2014 Given that we don't know what the value of the "DOWNLOADS" is, Maybe? Quote Link to comment Share on other sites More sharing options...
scottiescotsman Posted March 3, 2014 Author Share Posted March 3, 2014 DOWNLOADS is just the value of the amount of times the FILE has been downloaded i.e. [id]=2,[FILE]=01.zip,[DOWNLOADS]=45. I have a download.php which works great and increases the downloads by one every time the file is downloaded. All I want to do is view the amount of times its downloaded on FLASH page LOAD and if it is updated. Quote Link to comment Share on other sites More sharing options...
requinix Posted March 4, 2014 Share Posted March 4, 2014 What you have sure looks like it will display the number of downloads. Still not clear what Flash has to do with this though. Quote Link to comment Share on other sites More sharing options...
scottiescotsman Posted March 4, 2014 Author Share Posted March 4, 2014 (edited) I have a flash website and want to view it on MovieClip, which I have got for every different file on my page. prob easier to go look at it. www.scottiescotsman.com and go to downloads then just click on the first 5 links as that is all that work at the moment. all are dummy zips .. just want to view the value of DOWNLOADS if I specify the id the downloads work and updates the download_manager table as I have checked, but cant get it to view the value of the amount of times its been downloaded as the page loads here is the as3 code I have.. viewing the value I cant seem to get really need help please //--###### IMPORT ######--//import flash.events.Event;import flash.net.URLRequest;import flash.net.URLVariables;import flash.net.URLLoader;//--# DOWNLOAD COUNTER #--//var request:URLRequest = new URLRequest("update.php?xx=1");var getVariables:URLLoader = new URLLoader();getVariables.dataFormat = URLLoaderDataFormat.VARIABLES;getVariables.addEventListener(Event.COMPLETE, completeHandler);getVariables.load(request);function completeHandler(event:Event):void{var urlVariables:URLVariables = new URLVariables();var data = urlVariables.decode(event.target.data);dCounter.condenseWhite = true;dCounter.textField.opaqueBackground = 0x333333;dCounter.htmlText = "" + data.returnBody;}//--# DOWNLOAD BUTTON #--//dload01.addEventListener(MouseEvent.MOUSE_OVER, dOver);dload01.addEventListener(MouseEvent.MOUSE_OUT, dOut);dload01.addEventListener(MouseEvent.CLICK, dClick);function dClick (e:MouseEvent):void{navigateToURL(new URLRequest("download.php?file=temp_01.zip"), '_self');}function dOut (e:MouseEvent):void{dload01.gotoAndPlay("out");}function dOver (e:MouseEvent):void{dload01.gotoAndPlay("over");}//--####### STOP #######--// Edited March 4, 2014 by scottiescotsman Quote Link to comment Share on other sites More sharing options...
scottiescotsman Posted March 4, 2014 Author Share Posted March 4, 2014 OK I just went through a load of reading and got it to sort of work lol.... When I run my FLASH page and load the page for a specific file. The download_manager table is as follows [only 5 showing as example .. have 1 to 40] id FILE DOWNLOADS == === ============ 1 01.zip 34 2 02.zip 7 3 03.zip 11 4 04.zip 0 5 05.zip 1 if I specify the row with the id value, all I want is to view the corresponding DOWNLOADS value on same row. AS3 script on page.. //--###### IMPORT ######--// import flash.events.Event; import flash.net.URLRequest; import flash.net.URLVariables; import flash.net.URLLoader; //--# DOWNLOAD COUNTER #--// var request:URLRequest = new URLRequest("update.php?xx=1"); var getVariables:URLLoader = new URLLoader(); getVariables.dataFormat = URLLoaderDataFormat.VARIABLES; getVariables.addEventListener(Event.COMPLETE, completeHandler); getVariables.load(request); function completeHandler(event:Event):void { var urlVariables:URLVariables = new URLVariables(); var data = urlVariables.decode(event.target.data); dCounter.condenseWhite = true; dCounter.textField.opaqueBackground = 0x333333; dCounter.htmlText = "" + event.target.data.returnBody; } //--# DOWNLOAD BUTTON #--// dload01.addEventListener(MouseEvent.MOUSE_OVER, dOver); dload01.addEventListener(MouseEvent.MOUSE_OUT, dOut); dload01.addEventListener(MouseEvent.CLICK, dClick); function dClick (e:MouseEvent):void { navigateToURL(new URLRequest("download.php?file=temp_01.zip"), '_self'); } function dOut (e:MouseEvent):void { dload01.gotoAndPlay("out"); } function dOver (e:MouseEvent):void { dload01.gotoAndPlay("over"); } //--####### STOP #######--// PHP on server <?php error_reporting(E_ALL^E_NOTICE); require('connect.php'); $body=""; $result = mysqli_query("SELECT * FROM download_manager WHERE id = 'xx'"); $data = mysqli_fetch_assoc($result); $result->close(); $body = '<b><font name="Teen" color="#009999" size="11">' . $data['DOWNLOADS'] . '</font></b> '; echo "returnBody=$body"; exit(); ?> Gives an undefined result plzplz help Thanks Steven Quote Link to comment Share on other sites More sharing options...
scottiescotsman Posted March 10, 2014 Author Share Posted March 10, 2014 <?php error_reporting(E_ALL^E_NOTICE); require_once 'connect.php'; $id = $_GET['xx']; $body = ""; $sql = mysql_query("SELECT * FROM download_manager WHERE id = $id"); $row = mysqli_fetch_assoc($sql); $downloads = $row["DOWNLOADS"] $body .= '<b><font name="Teen" color="#009999" size="11">' . $downloads . '</font></b>'; mysql_free_result($sql) mysql_close(); echo "returnBody=$body"; exit(); ?> [php] please, please can someone help with this as it is so simple but cant get it to work & have been at it for 2-3 weeks. Its so easy its dumb. TABLE AS FOLLOWS id FILE DOWNLOADS == === ============ 1 01.zip 34 2 02.zip 7 3 03.zip 11 4 04.zip 0 5 05.zip 1 All I want is the download column where I specify the id to show in flash AS3. [AS] var variables_re:URLVariables = new URLVariables(); var varSend_re:URLRequest = new URLRequest("update.php?xx='1'"); varSend_re.method = URLRequestMethod.POST; varSend_re.data = variables_re; var varLoader_re:URLLoader = new URLLoader; varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES; varLoader_re.addEventListener(Event.COMPLETE,completeHandler_re); function completeHandler_re(event:Event):void{ if(event.target.data.returnBody==""){ dCounter.textField.opaqueBackground = 0x333333; dCounter.text="No data coming through." }else{ dCounter.editable = false; dCounter.condenseWhite = true; dCounter.textField.opaqueBackground = 0xFFFFFF; dCounter.htmlText = "" + event.target.data.returnBody; } } variables_re.comType = "requestEntries"; varLoader_re.load(varSend_re); [/AS] everyone says code is good on both so why can I not see it on my page when loaded PLZ PLZ PLZ HELP Quote Link to comment 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.