scottiescotsman Posted March 2, 2014 Share Posted March 2, 2014 (edited) Hi I am new to PHP & SQL but have managed to have a functioning guestbook and download counter. At present they both work but I cant seem to code how to get the download counter to display on my flash movie clip. I have tried numerous different ways but as I am new I don't really know what I am doing lol. The SQL table [download_mamager] is formatted as follows .... id, FILE, DOWNLOADS but all I want to do is get the value of the DOWNLOADS column at the row I specify. ie. $data = mysqli_query("SELECT DOWNLOADS FROM downloads_manager WHERE id = 'xx'"); and view the result on a flash textfield. hope someone can help cant seem to figure out how to add my as3 code here update.php Edited March 2, 2014 by scottiescotsman Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/ Share on other sites More sharing options...
trq Posted March 2, 2014 Share Posted March 2, 2014 mysqli_query returns a mysqli_result object on success. This object will need to be iterated through in order to display any resulting data. There are examples on the man page. http://php.net/mysqli_query Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471226 Share on other sites More sharing options...
scottiescotsman Posted March 2, 2014 Author Share Posted March 2, 2014 Am I getting these examples right ... #1. I query one for the row to get the row data #2. another one to split the data up into id, FILE, DOWNLOADS so I can use the downloads data ? hope I am right Thanks for your help Steven Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471233 Share on other sites More sharing options...
Ch0cu3r Posted March 2, 2014 Share Posted March 2, 2014 (edited) mysqli_query returns a result set. To get out of the result set you need to use one of the mysqli_fetch_* functions $result = mysqli_query("SELECT DOWNLOADS FROM download_manager WHERE id = 'xx'"); // query returns a resultset $data = mysqli_fetch_assoc($result); // get the data from the resultset $body = '<b><font name="Teen" color="#009999" size="11">' . $data['DOWNLOADS'] . '</font></b> '; Edited March 2, 2014 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471258 Share on other sites More sharing options...
scottiescotsman Posted March 2, 2014 Author Share Posted March 2, 2014 Thanks for your reply I shall let you know how I get on. Thanks Steven Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471265 Share on other sites More sharing options...
scottiescotsman Posted March 2, 2014 Author Share Posted March 2, 2014 <?phperror_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();?> hope that's right Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471268 Share on other sites More sharing options...
scottiescotsman Posted March 15, 2014 Author Share Posted March 15, 2014 <?php require_once ('connect.php'); $id = $_GET['xx']; $body = ""; if ($id == 0) { $body = '<b><font color="#009999" size="11">NO DATA</font></b>'; } else { $result = mysql_query("SELECT * FROM download_manager WHERE id = $id"); $row = mysql_fetch_assoc($result); $body = '<b><font name="Teen" color="#009999" size="13" align="left">'.$row['DOWNLOADS'].'</font></b>'; } echo "returnBody=$body"; exit(); ?> All fixed now Quote Link to comment https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1472661 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.