Estoy haciendo una aplicacion en Flex 3 , PHP y SQL basado en un tutorial que lei
(http://www.cristalab.com/tutoriales/243/conectar-flex-3-con-php-usando-weborb)
Aqui el codigo en flex 3
Código :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="init()"
>
<mx:RemoteObject
id="Service"
destination="GenericDestination"
source="HelloWorld"
showBusyCursor="true"
result="onResult(event);"
fault="onFault(event);"
/>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function onResult(event:ResultEvent):void{
trace("<<>>",event.result)
}
private function onFault(event:FaultEvent):void{
trace("ERROR: ",event.fault.faultString)
}
private function init():void{
Service.object2array("Me pica el poto");
}
]]>
</mx:Script>
</mx:Application>
y este es el codigo en PHP
Código :
<?php
class HelloWorld {
function object2array($TargetArray)
{
if(!(is_array($TargetArray) || is_object($TargetArray)))
{
$dato = $TargetArray;
}
else
{
foreach($TargetArray as $key => $valor1)
{
$dato[$key] = object2array($valor1);
}
}
$con=mysql_connect("localhost","root","admin");
if(!$con){
die("Error en la Conexión al Motor de BD");
}
$seleccion_bd=mysql_select_db("prueba",$con);
if(!$seleccion_bd){
die("Error en la selección de la Base de Datos");
}
$ingresar_dato= "INSERT INTO nombre FROM prueba VALUES('$dato');";
$ejecucion_ingresar=@mysql_query($ingresar_dato,$con);
if(!$ejecucion_sacar){
die("Error en la Insercion");
return "Hola mundo";
}else{
return "Hola mundo";
}
}//End function
}
en la sentencia SQL para ingresar los datos pongo como valor $dato, pero me da error y no ingresa $dato a la BD.
¿Que puedo hacer para arreglar este problema
Bueno de antemano gracias
