No se me ocurre por qué está ocurriendo esto. Cualquier ayuda se agradece. Les dejo los códigos.
Un saludo y muchas gracias.
Con este fragmento recibo la variable en flash:
Código ActionScript :
private function recogerId():void {
var req:URLRequest=new URLRequest("http://servidorejemplo.com/prototipo/devuelveId.php");
var loader:URLLoader = new URLLoader();
loader.dataFormat=URLLoaderDataFormat.VARIABLES;
req.method=URLRequestMethod.POST;
loader.load(req );
loader.addEventListener( Event.COMPLETE, loadCompleteHandler );
}
function loadCompleteHandler( e:Event ):void {
var variable:URLVariables=new URLVariables(e.target.data);
ultima=Number(variable.ultima);
id=Number(variable.id);
setupClips();
}
Con este fragmento envío la variable a php:
Código ActionScript :
private function enviarId() {
var scriptRequest:URLRequest=new URLRequest("http://servidorejemplo.com/prototipo/devuelveId.php");
var scriptLoader:URLLoader=new URLLoader ;
var scriptVars:URLVariables=new URLVariables ;
scriptVars.id=String(id);
scriptRequest.method=URLRequestMethod.POST;
scriptRequest.data=scriptVars;
scriptLoader.load(scriptRequest);
scriptLoader.addEventListener(Event.COMPLETE,enviado);
}
function enviado(e:Event) {
recogerId();
}Finalmente este es el PHP
Código PHP :
<?php
require("config.php");
$db = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbdatabase, $db);
$sql = "SELECT * FROM entradas
ORDER BY id DESC
LIMIT 1";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$ultima=$row['id'];
if (isset($_POST['id']))
{
$id = $_POST['id'];
} else{
$id=$row['id'];
}
print "id=$id&ultima=$ultima";
?> 