Comunidad de diseño web y desarrollo en internet online

AMFPHP Y BASE DE DATOS, CONSULTA!

Citar            
MensajeEscrito el 03 Oct 2008 02:52 pm
Hola, saludos a todos. Tengo una conexion hecha en flash a una base de datos mediante AMFPHP. La conexion funciona bien, y desplega los ficheros de la base. Ahora tengo unos 200 registros en la BD y queria saber como hacer un buscador para encontrar un registro en particular
Tambien queria saber como hacer un boton de editar otro de crear y uno mas de borrar registros de la base de datos.

Gracias de antemano y Saludos a todos!

Fede

Por fedefazz

3 de clabLevel



 

safari
Citar            
MensajeEscrito el 03 Oct 2008 02:54 pm
Pues agregando mas metodos en la clase PHP y llamandolos desde Flash. Tendrias que ser mas especifico

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 03 Oct 2008 04:45 pm
JORGE GRACIAS POR TU RESPUESTA TE COPIO UNA PARTE DEL CODIGO ASI ENTENDES MEJOR

ESTO ES EN UN FRAME

//**************************************************
// importamos las clases remoting e inicializamos el debuger
import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
NetDebug.initialize ();
//**************************************************
//inicializamos la conexion con el PHP
host = "http://www.eliseogroup.com.ar/basededatos/amfphp/gateway.php";
conexion = new Connection ();
conexion.connect (host);
//**************************************************
//Generamos el relayresponder que contiene los callbacks
relay_getData = new RelayResponder (this, "getData_ok", "getData_error");
mySQL = new Service (null, null, "mySQL", conexion, relay_getData);
//**************************************************
//Llamamos al metodo getData del PHP
query = "SELECT * FROM comercios";
mySQL.getData (query);



EN OTRO FRAME

//Generamos los callbacks
getData_ok = function (objet_)
{

recordSet = objet_.result;
columnas = recordSet.mTitles;
registros = recordSet._items;
paginar(0)
//recorrerRegistros()
};
getData_error = function ()
{
trace ("Hubo un error al conectar");
};

EN OTRO FRAME RECORRO LOS REGISTROS

recorrerRegistros = function ()
{
var master = contenedor_mc.modulo_mc
master._visible = false
var i = 0;
while (i<registros.length)
{
trace ("Registro: "+i);
var mc_= master.duplicateMovieClip(String(i),i);
mc_._y += (mc_._height + 5) * i
trace(mc_)

var registro_ = registros[i];
var j = 0;
while (j<columnas.length)
{
var columna_ = columnas[j];
trace (columna_+":"+registro_[columna_]);
mc_[columna_].text = registro_[columna_]
j++;
}
i++;
}
};



DESPUES HAY OTRA FUNSION DE PAGINADO QUE LO QUE HACE ES MOSTRAME 3 REGISTRO O LOS QUE YO QUIERA POR PAGINA Y PODER PASAR DE PAGINA EN PAGINA. LO QUE QUIERO HACER ES UN BUSCADOR PARA BUSCAR UN REGISTRO ESPECIFICO

GRACIAS!!!


SALUDOS

Por fedefazz

3 de clabLevel



 

safari
Citar            
MensajeEscrito el 03 Oct 2008 05:07 pm
Los pasos serian

1. Haz la parte de PHP (select ... where ....) que devuelve el recordset
2. Manda el parametro de busqueda desde Flash

Tu estas mandando el query directamente a tu clase, algo que tienes que reconsiderar, porque si pillo tu aplicacion y hago

mySQL.getData ("delete from comercios");

puede llegar a ser peligroso, no crees?

Yo tenia algo hecho de esto, pero usaba un componente que ya no existe (remoting connector), igual a lo mejor te aclara algo: http://www.flash-db.com/Tutorials/update/

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.