Foros del Web » Creando para Internet » Flash y Actionscript »

Datagri + PHP + Flash + MYSQL

Estas en el tema de Datagri + PHP + Flash + MYSQL en el foro de Flash y Actionscript en Foros del Web. Hola: Primero dar las gracias por el Trabajo que hacen aquí, con sus tutoriales y respuestas. El problema que tengo es el siguiente, estoy haciendo ...
  #1 (permalink)  
Antiguo 01/06/2011, 21:14
 
Fecha de Ingreso: mayo-2010
Mensajes: 6
Antigüedad: 14 años
Puntos: 0
Pregunta Datagri + PHP + Flash + MYSQL

Hola:

Primero dar las gracias por el Trabajo que hacen aquí, con sus tutoriales y respuestas.

El problema que tengo es el siguiente, estoy haciendo una aplicacion para conectar una base de datos por php y reflejarlo en un datagrid y editar los registros el tema es que no me funciona y no se el porque, no soy muy avanzado en esto realmente.

Adjunto los PhP y el AS2

Cust_form_data.php

<?php
include "host.ini";
mysql_connect($host,$user,$pass);
mysql_select_db($db);
$r="SELECT
`Nombre`.`cust_id_num`,
`Nombre`.`Usuario`,
`Nombre`.`Password`,
`Nombre`.`Nombre`,
`Nombre`.`Apellido`,
`Nombre`.`Empresa`,
`Nombre`.`Direccion`,
`Nombre`.`Telefono`,
`Nombre`.`Rut`,
`Nombre`.`Ciudad`,
`Nombre`.`Comuna`,
`Nombre`.`Giro`,
`Nombre`.`Correo`
FROM
`Nombre`
WHERE
`Nombre`.`cust_id_num` = '$cust_id_num'
ORDER BY
`Nombre`.`Usuario` ASC";
$rr = mysql_query("$r")or die("problem!" . mysql_error());
list($cust_id_num,$Usuario,$Password,$Nombre,$Apel lido,$Empresa,
$Direccion,$Telefono,$Rut,$Ciudad,$Comuna,$Giro,$C orreo) =
mysql_fetch_row($rr);
echo "&cust_id_num=" . $cust_id_num;
echo "&use_ti=" . $Usuario;
echo "&pass_ti=" . $Password;
echo "&nom_ti=" . $Nombre;
echo "&ape_ti=" . $Apellido;
echo "&emp_ti=" . $Empresa;
echo "&rut_ti=" . $Rut;
echo "&gir_ti=" . $Giro;
echo "&cui_ti=" . $Ciudad;
echo "&com_ti=" . $Comuna;
echo "&dir_ti=" . $Direccion;
echo "&cor_ti=" . $Correo;
echo "&tel_ti=" . $Telefono;
?>

Cust_datagrid.php

<?php

include "host.ini";
mysql_connect($host,$user,$pass);
mysql_select_db($db);
//This is the SQL querty - just a simple select query.
$x="SELECT
`Nombre`.`cust_id_num`,
`Nombre`.`Usuario`,
`Nombre`.`Password`,
`Nombre`.`Nombre`,
`Nombre`.`Apellido`,
`Nombre`.`Empresa`,
`Nombre`.`Direccion`,
`Nombre`.`Telefono`,
`Nombre`.`Rut`,
`Nombre`.`Ciudad`,
`Nombre`.`Comuna`,
`Nombre`.`Giro`,
`Nombre`.`Correo`
FROM
`Nombre`
ORDER BY
`Nombre`.`Usuario` ASC";
//PHP reads the mysql data into an array
$xx = mysql_query("$x")or die("problem!" . mysql_error());
list($cust_id_num,$Usuario,$Password,$Nombre,$Apel lido,$Empresa,
$Direccion,$Telefono,$Rut,$Ciudad,$Comuna,$Giro,$C orreo) =
mysql_fetch_row($xx);
/* The PHP code below formats the database results into an array readable by the Flash
datagrid.*/
$i = 0;
$n = 0;
$results = mysql_query("$x");
$n= mysql_num_rows ($results);
while ($row = mysql_fetch_array ($results)) {
while (list ($key, $val) = each ($row)) {
$r_string .= '&' . $key . $i . '=' . stripslashes($val);
}
$i++;
}
echo "&i=" . $i;
echo "&n=" . $n;
$r_string .='&';
echo"&$r_string";
?>

AS2

/*This defines the location of the files we are going
to use in this program. */
_global.mypath = "http://www.digitaldesing/JLS/"

//This defines the datagrid columns
import mx.controls.DataGrid;
import mx.controls.gridclasses.DataGridColumn;

var column = new DataGridColumn("j1");
column.headerText = "Usuario";
column.width = 80
mostrar_ti.addColumn(column);

var column = new DataGridColumn("j2");
column.headerText = "Password";
column.width = 80;
mostrar_ti.addColumn(column);

var column = new DataGridColumn("j3");
column.headerText = "Nombre";
column.width = 100;
mostrar_ti.addColumn(column);

var column = new DataGridColumn("j4");
column.headerText = "Apellido";
column.width = 120;
mostrar_ti.addColumn(column);
mostrar_ti.addEventListener("headerRelease", headerListener);
mostrar_ti.dataProvider = r_string;
mostrar_ti.scrollToTop();
mostrar_ti.dataProvider = r_string;

// This reads the data from the PHP script and populates the datagrid.
var sendData = new LoadVars();
var r_string = new LoadVars();
r_string.onLoad = getResponse;

sendData.addr = propDgrid.selectedItem.j2
job_id_num=custDgrid.selectedItem.cust_id;
mypath89 =_global.mypath + "Cust_datagrid.php";
sendData.sendAndLoad(mypath89, r_string, "post");

function getResponse(result){
if (result == true) {
var r_string = new Array();
for (var i:Number=0; i < this.n; i++) {
r_string.push(
{ cust_id_num:this["cust_id_num"+i],
j1:this["use_ti"+i],
j2:this["pass_ti"+i],
j3:this["nom_ti"+i],
j4:this["ape_ti"+i]
})};

}
mostrar_ti.dataProvider = r_string;
}

//Populate the form
//==============Show Customer Details=========================
custf=function(){
var sendData = new LoadVars();
var recData = new LoadVars();
recData.onLoad = getResponse1;
sendData.cust_id_num = mostrar_ti.selectedItem.cust_id_num;
mypath81 =_global.mypath + "Cust_form_data.php";
sendData.sendAndLoad(mypath81, recData, "post");
}

function getResponse1(result){

if (result == true) {
use_ti.text = this['use_ti'];
pass_ti.text= this['use_ti'];
nom_ti.text= this['nom_ti'];
ape_ti.text= this['ape_ti'];
emp_ti.text= this['emp_ti'];
rut_ti.text= this['rut_ti'];
gir_ti.text= this['gir_ti'];
cui_ti.text= this['cui_ti'];
com_ti.text= this['com_ti'];
dir_ti.text= this['dir_ti'];
cor_ti.text= this['cor_ti'];
tel_ti.text= this['tel_ti'];
}
}

mostrar_ti.addEventListener("cellPress",custf);

y la pagina donde esta el modelo http://www.dogotaldesing.cl/JLS/DataGrid.html
PHP:

http://www.dogotaldesing.cl/JLS/Cust_datagrid.php
http://www.dogotaldesing.cl/JLS/Cust_form_data.php

Espero me puedan ayudar y gracias de antemano

Etiquetas: datagrid, flash, mysql, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:59.