Jump to content

Recommended Posts

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 by scottiescotsman
Link to comment
https://forums.phpfreaks.com/topic/286649-php-to-flash-help/
Share on other sites

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 by Ch0cu3r
Link to comment
https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471258
Share on other sites

<?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();

?>

 

 

hope that's right

Link to comment
https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1471268
Share on other sites

  • 2 weeks later...

<?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 :)

Link to comment
https://forums.phpfreaks.com/topic/286649-php-to-flash-help/#findComment-1472661
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.