Comunidad de diseño web y desarrollo en internet online

Flash, AMFPHP y MySQL Guestbook

Citar            
MensajeEscrito el 02 Mar 2006 01:01 am
Hola. Encontré un tutorial para hacer un libro de visitas (Guestbook) por la web y me interesó mucho porque funciona jalando los datos de una tabla a textArea y es precisamente lo que quiero hacer. El problema es que me descargué los archivos del tutorial, hice la base de datos y la tabla mediante instrucciones SQL que trae el *.zip con los archivos, puse los archivos en las rutas correctas y cambie las rutas de los archivos PHP para que me funcioné y NO FUNCIONA :? . ¿Alguien me podría ayudar?, este es el tutorial:

http://www.klr20mg.com/flashwiki/doku.php?id=guestbook_flash_amfphp

El *.zip de los archivos del tutorial trae una carpeta "guestbook" con 5 archivos:

db.php
estilo.css
guestbook.fla -> Estos 3 archivos los puse en: C:\AppServ\www\amfphp\guestbook (como indica el tutorial)

Y luego, trae el sql.txt que son las instrucciones SQL. Las ejecuté y todo salió perfecto.

Trae guest.php que es el archivo de funciones para los servicios y lo metí en: C:\AppServ\www\amfphp\services (como indica el tutorial)

Cambié las variables $pathfiles del archivo guest.php por:

$pathfiles = "http://localhost/amfphp/guestbook"; (que es donde está mi db.php)

Y en db.php cambie las variables de

$host = "localhost";
$user = "root";
$passwd = "";
$dbName = "guestbook"; (que son esos mis datos de host, user, pass y db name)

Por ultimo, cambie en el script de flash la variable:

urlGateway = "http://localhost/amfphp/gateway.php"; (que es donde está mi gateway)

Como ven, hice todo lo necesario :( , tengo Macromedia Flash v8.0, AMFPHP y Flash Remoting Components for MX 2004 AS v2.0 en mi máquina y no me jala los datos de la base de datos :roll: , cosa que en ejemplo http://www.klr20mg.com/amfphp/guestbook/ si lo hace. ¿Alguien me puede echar una mano? :crap: . Mil gracias.

MQ.

Por Manuel Quintero

53 de clabLevel



Genero:Masculino  

msie
Citar            
MensajeEscrito el 02 Mar 2006 04:17 am
Que tal..

No se cual sea la razon por la cual no te funcione.. Como este ejemplo ya es algo viejo.. Flash MX 2004 y amfphp 0.9, baje los fuentes del sitio y probe..

Las pruebas fueron hechas sobre

PHP 5.0.5
AMFPHP 1.0 si mal no recuerdo :)
Mysql 4.x

El unico problema que encontre fue la inicializacion de una variable en el servicio la cual causaba que se enviara el mismo mensaje todas las veces..

la solucion es esta:

Código :

function getComments($indice, $cuantos) {
      $pathfiles = "";
        include ($pathfiles."db.php");
      $inicio = intval($indice*$cuantos);
      $sql = "select count(id) from libro";
      $res = mysql_query($sql);
      list($total) = mysql_fetch_array($res);
      $sql = "select * from libro order by id desc limit $inicio, ".$cuantos;
      $res = mysql_query($sql);
      $comments = array();
      while($row = mysql_fetch_array($res)) {
         $temp = "";
         $temp->total   = $total;
         $temp->nombre  = "<p class='nombre'>".$row['nombre']." dijo:</p><br>";
         $temp->mensaje = "<p class='mensaje'>".$row['mensaje']."</p><br>";
         $temp->hora    = "<p class='hora'>Escrito : ".$this->makeDate($row['hora'])."</p><br>";
         array_push($comments, $temp);
      }
      return $comments;
   }


Ahora, puedes utilizar el panel de netconnection debugger para ver el error o puedes tambien utilizar NetDebug::trace(); en tus PHPs para un mayor debugueo... :wink:

ahh.. Para usar el debugger debes importar las clases necesarias e inicializar el debug.

Código :

import mx.services.Log;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();


Cuando tenga tiempo actualizo el wiki con los nuevos archivos

Saludos!! [/code]

Por Tmeister

260 de clabLevel

2 tutoriales

 

firefox
Citar            
MensajeEscrito el 23 Feb 2008 07:13 am
hola, coye el tutorial ya no se encuentra disponible en la web de :
http://www.klr20mg.com/flashwiki/doku.php?id=guestbook_flash_amfphp

Amigos Sabrian ustedes donde puedo descargar esos archivos.- o ver el tutorial completo.-

Gracias.-

Por xyyy7

16 de clabLevel



 

Béisbol, Petróleo y Mujeres Bellas.- Venezuela (Maracay)

firefox
Citar            
MensajeEscrito el 23 Feb 2008 05:49 pm
Lito amigos, ya lo encontre... aqui se los dejo : es bastante simple pero efectivo.. se presta para hacerle ajustes...

Código :

import mx.remoting.*;
import mx.rpc.*;
import mx.utils.Delegate;
import mx.services.Log;
import mx.remoting.debug.NetDebug;
urlRemoting = "AQUI EN URL SERVICES";
var gatewayUrlProcess:String = urlRemoting;
NetDebug.initialize();


var myService:Service = new Service(gatewayUrlProcess, null, "guest", null, null);
function init() {
   Stage.scaleMode = "noScale";
   showComments = 5;
   cont_ta.html = true;
   cont_ta.wordWrap = true;
   send_btn.onRelease = sendInfo;
   ant_btn.onRelease = backPage;
   sig_btn.onRelease = nextPage;
   ant_btn._visible = false;
   sig_btn._visible = false;
   indice = 0;
   name_txt.onSetFocus = mens_txt.onSetFocus=function () {
      output_txt.text = "";
   };
   doStyles();
   var mContent:PendingCall = myService.getComments(0, showComments);
   mContent.responder = new RelayResponder(this, "makeContent");
}
function sendInfo() {
   if (name_txt.text.length && mens_txt.text.length) {
      comment = [name_txt.text, mens_txt.text, mail_txt.text];
      var mContent:PendingCall = myService.insertComment(comment);
      mContent.responder = new RelayResponder(this._parent, "remakeContent");
   } else {
      output_txt.text = "Nombre y mensaje son requeridos";
   }
}
function doStyles() {
   styles = new TextField.StyleSheet();
   styles.load("estilo.css");
   styles.onLoad = function(ok) {
      if (ok) {
         cont_ta.styleSheet = this;
      }
   };
}
function remakeContent(obj) {
   if (obj.result) {
      indice = 0;
      var mContent:PendingCall = myService.getComments(0, showComments);
      mContent.responder = new RelayResponder(this, "makeContent");
      clean();
   } else {
      output_txt.text = "Ocurrio un error, Intentalo de nuevo";
   }
}
function makeContent(obj) {
   obj = obj.result;
   cont_ta.vPosition = 0;
   t_temp = "";
   for (var a = 0; a<obj.length; a++) {
      t_temp += obj[a].nombre+obj[a].mensaje+obj[a].hora;
   }
   if (obj[0].total>0) {
      pages = Math.ceil(obj[0].total/showComments);
      cuantos_txt.text = "Pagina "+(indice+1)+" de "+pages;
   } else {
      cuantos_txt.text = "Aun no hay mensajes";
   }
   setBottons();
   cont_ta.text = t_temp;
}
function setBottons() {
   ant_btn._visible = false;
   sig_btn._visible = false;
   if (indice != 0) {
      ant_btn._visible = true;
   }
   if (indice<(pages-1)) {
      sig_btn._visible = true;
   }
}
function backPage() {
   var mContent:PendingCall = myService.getComments(--indice, showComments);
   mContent.responder = new RelayResponder(this._parent, "makeContent");
}
function nextPage() {
   var mContent:PendingCall = myService.getComments(++indice, showComments);
   mContent.responder = new RelayResponder(this._parent, "makeContent");
}
function clean() {
   name_txt.text = "";
   mail_txt.text = "";
   mens_txt.text = "";
}
init();


Saludos.-

Por xyyy7

16 de clabLevel



 

Béisbol, Petróleo y Mujeres Bellas.- Venezuela (Maracay)

firefox

 

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