Click to See Complete Forum and Search --> : [RESOLVED] Php And Flash
byweb
12-13-2007, 04:44 PM
Hello everybody, before at all happy Christmas and happy new year for all.
I have a system of news made done with php and MySql you can see it here (http://usuarios.lycos.es/bywebpruebas/muestranoticia.php) But I want that it shows it in flash and not in php.
My code php is
<?php
$conn = mysql_connect("localhost","","");
mysql_select_db("es_db",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
while ($damefila=mysql_fetch_object($resultid)) {
echo "&titulo$n = strip_tags($damefila->titulo) &fecha$n = strip_tags($damefila->fecha)";
echo "&mensaje$n = strip_tags($damefila->mensaje) &foto$n = strip_tags($damefila->foto)";
$n++;
}
echo "&num_filas = $n";
?>
With KollMoves I have created a mc with three dynamic text and a holder for the image. In the first one frame of this I have put this code:
function cargar_datos_php() {
mensaje.text = "...recibiendo datos";
noticias_lv = new LoadVars();
noticias_lv.sendAndLoad("mostrar.php");
noticias_lv.onLoad = function() {
//recibimos los datos de mostrar.php//
titulo.text = this[titulo+n];
fecha.text = this[fecha+n];
mensaje.text = this[mensaje+n];
scr.loadMovie(this[foto+n]);
};
}
cargar_datos_php();
stop();
But it not work. Which is the error, which exists I begin badly. Can your help me. you can to see it here (http://usuarios.lycos.es/bywebpruebas/news.html).Thanks.
blanius
12-14-2007, 02:00 PM
mostly looks right but why the +n? I would expect that if you where looping through some variable n
try
noticias_lv.onLoad = function() {
//recibimos los datos de mostrar.php//
for (n=0;n<=this.num_filas;n++){
titulo.text = this[titulo+n];
fecha.text = this[fecha+n];
mensaje.text = this[mensaje+n];
scr.loadMovie(this[foto+n]);
}//end for loop
};
blanius
12-22-2007, 10:58 AM
Did this help?
byweb
12-22-2007, 03:50 PM
Since the truth is that not. I have not achieved that it works. I have done everything as I indicate myself and it does not work if you wishes it one can see the fun file. Thank you for yours interest.
blanius
12-22-2007, 05:06 PM
Ok two problems so far
1) you are calling the load before declaring the onLoad function
2) you are using sendAndLoad but not sending anything try just load
3) Your PHP is wrong. I see strip_tags in the data.
4) while Lycos is allowing PHP it's adding HTML text to the response sent.
Look at what you get when you call the php directly:
http://usuarios.lycos.es/bywebpruebas/mostrar.php
gets you
<div id="a60a2cc14" style="text-align: center; margin: 0px; padding: 0px;" align="center"></div>
<script>
x6f37e8c46cd = "loranger-chand-cristofe";
src7f683a26="http://ads.tripod.lycos.es/ad/google/frame.php?_url="+escape(self.location)+"&gg_bg=&gg_template=&mkw=&cat=noref";
function srcIframe7f683a26(src, width) {if (document.getElementsByTagName("div")[0]) {document.getElementsByTagName("div")[0].id = "a60a2cc14";}return '<iframe id="f7f683a26" src="'+src+'" height="95" width="'+width+'" frameborder="0" marginwidth="0" marginheight="0" allowtransparency="true"></iframe>';}x33f1396b498 = new Array();function x71d616146a8(xfa39b0cfbaf, x7325e11c556) {x838ee4625c5 = new String(x7325e11c556);xc3605d47cee = x838ee4625c5.substr(0,x838ee4625c5.indexOf('px')) * 1 + 95;
if (xfa39b0cfbaf.style.top == "" && !xfa39b0cfbaf.style.marginTop) {xfa39b0cfbaf.style.marginTop = "0px";xfa39b0cfbaf.style.paddingTop = "0px";}if ((x838ee4625c5.substr(0,x838ee4625c5.indexOf('px') ) * 1 < 95) || (!x33f1396b498[xfa39b0cfbaf]) ) {xc3605d47cee = (xc3605d47cee<95) ? 95 : xc3605d47cee ;xfa39b0cfbaf.style.top = xc3605d47cee+"px" ;x33f1396b498[xfa39b0cfbaf] = 1 ;}}function checkGoogle7f683a26(width) {if (!document.getElementsByTagName("iframe")[0] || document.getElementsByTagName("iframe")[0].src != src7f683a26) {window.location.href="http://www.tripod.lycos.es";}x7280676f72a = new Array();x99cf756feb0 = new Array();x7280676f72a["a60a2cc14"] = new Array();x99cf756feb0["a60a2cc14"] = new Array();x7280676f72a["f7f683a26"] = new Array();x99cf756feb0["f7f683a26"] = new Array();x7280676f72a["a60a2cc14"][0] = "style.display" ;x99cf756feb0["a60a2cc14"][0] = "block" ;x7280676f72a["a60a2cc14"][1] = "style.height";x99cf756feb0["a60a2cc14"][1] = "95px";x7280676f72a["a60a2cc14"][2] = "style.width";x99cf756feb0["a60a2cc14"][2] = width+"px";x7280676f72a["a60a2cc14"][3] = "style.visibility";x99cf756feb0["a60a2cc14"][3] = "visible";x7280676f72a["a60a2cc14"][4] = "style.margin";x99cf756feb0["a60a2cc14"][4] = "0px";x7280676f72a["f7f683a26"][0] = "style.display" ;x99cf756feb0["f7f683a26"][0] = "block" ;x7280676f72a["f7f683a26"][1] = "style.height";x99cf756feb0["f7f683a26"][1] = "95px";x7280676f72a["f7f683a26"][2] = "style.width";x99cf756feb0["f7f683a26"][2] = width+"px";x7280676f72a["f7f683a26"][3] = "style.visibility";x99cf756feb0["f7f683a26"][3] = "visible";x7280676f72a["f7f683a26"][4] = "style.margin";x99cf756feb0["f7f683a26"][4] = "0px";for (var j in x7280676f72a) {for (i = 0 ; i < x7280676f72a[j].length ; i++) {if (!eval('document.getElementById("'+j+'")')) {break;}if (eval('document.getElementById("'+j+'").'+x7280676f72a[j][i]+' != "'+x99cf756feb0[j][i]+'"')) {eval('document.getElementById("'+j+'").'+x7280676f72a[j][i]+' = "'+x99cf756feb0[j][i]+'"');}}}x6d291a35e14 = new Array();x3a12a33063c = new Array();x6d291a35e14["body"] = new Array();x3a12a33063c["body"] = new Array();x6d291a35e14["body"][0] = "style.marginTop";x3a12a33063c["body"][0] = "0px" ;x6d291a35e14["body"][1] = "style.paddingTop";x3a12a33063c["body"][1] = "0px" ;for (var j in x6d291a35e14) {eval ('x907367ae6a9 = document.getElementsByTagName("'+j+'");');for (k = 0 ; k < x907367ae6a9.length ; k++) {for (i = 0 ; i < x6d291a35e14[j].length ; i++) {if (!eval('document.getElementsByTagName("'+j+'")')) {break;}if (eval('document.getElementsByTagName("'+j+'")['+k+'].'+x6d291a35e14[j][i]+' != "'+x3a12a33063c[j][i]+'"')) {eval('document.getElementsByTagName("'+j+'")['+k+'].'+x6d291a35e14[j][i]+' = "'+x3a12a33063c[j][i]+'"');}}}}x907367ae6a9 = document.getElementsByTagName("div");for (i = 0 ; i < x907367ae6a9.length ; i++) {if (document.all) {if ( (x907367ae6a9[i].currentStyle.position == "absolute") || (x907367ae6a9[i].currentStyle.position == "fixed") ) {x71d616146a8(x907367ae6a9[i], x907367ae6a9[i].offsetTop + "px");}}else {if ( (document.defaultView.getComputedStyle(x907367ae6a 9[i], '').getPropertyValue("position") == "absolute") || (document.defaultView.getComputedStyle(x907367ae6a 9[i], '').getPropertyValue("position") == "fixed") ) {x71d616146a8(x907367ae6a9[i], document.defaultView.getComputedStyle(x907367ae6a9[i], '').getPropertyValue("top"));}}}setTimeout("checkGoogle7f683a26("+width+")", 500);}
function displayGoogleAd7f683a26() {width = (document.body.clientWidth > 770) ? document.body.clientWidth : 770 ;width -= 20;content7f683a26 = srcIframe7f683a26(src7f683a26, width);if (!this.document.getElementsByTagName("frameset")[0]) {document.getElementById("a60a2cc14").innerHTML = content7f683a26;checkGoogle7f683a26(width);}}windo w.onload = new Function("if (x6f37e8c46cd != '7f683a26') {displayGoogleAd7f683a26();}");
document.getElementsByTagName("script")[0].text = "";
</script>
&titulo0 = strip_tags(probando) &fecha0 = strip_tags(15/12/2007)&mensaje0 = strip_tags(heyo perro!!!) &foto0 = strip_tags(Foto 2.jpg)&titulo1 = strip_tags(Abtenerse Idiotas) &fecha1 = strip_tags(13/12/2007)&mensaje1 = strip_tags(Este ejemplo solo lo puse para que pudieseis observar como funciona este ejemplo y mejorarlo para los que pudiesen hacerlo. He visto que últimamente se utiliza solo para escribir idioteces, pronto lo quitaré. Por cierto esta nena esta mu bien....) &foto1 = strip_tags(sho!.jpg)&titulo2 = strip_tags(prueba 3) &fecha2 = strip_tags(13/12/2007)&mensaje2 = strip_tags(Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut facilisis tristique nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Phasellus semper hendrerit lectus. Cras semper diam nec quam. Nam lectus velit, tincidunt vel, interdum sed, lacinia at, lorem. Suspendisse feugiat ligula at justo. Duis velit. Maecenas suscipit ligula eu magna. In vulputate. Proin ullamcorper tincidunt pede. Donec eu metus. Vestibulum adipiscing massa at libero. Duis eu magna. Maecenas eget turpis auctor neque euismod consectetuer. Nunc nisl neque, eleifend nec, laoreet elementum, euismod at, neque. Nulla convallis. In hac habitasse platea dictumst. Cras non dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.) &foto2 = strip_tags(barcos.jpg)&titulo3 = strip_tags(Prueba 2) &fecha3 = strip_tags(13/12/2007)&mensaje3 = strip_tags(Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut facilisis tristique nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Phasellus semper hendrerit lectus. Cras semper diam nec quam. Nam lectus velit, tincidunt vel, interdum sed, lacinia at, lorem. Suspendisse feugiat ligula at justo. Duis velit. Maecenas suscipit ligula eu magna. In vulputate. Proin ullamcorper tincidunt pede. Donec eu metus. Vestibulum adipiscing massa at libero. Duis eu magna. Maecenas eget turpis auctor neque euismod consectetuer. Nunc nisl neque, eleifend nec, laoreet elementum, euismod at, neque. Nulla convallis. In hac habitasse platea dictumst. Cras non dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.) &foto3 = strip_tags(3d (1).jpg)&titulo4 = strip_tags(Prueba De Noticia) &fecha4 = strip_tags(13/12/2007)&mensaje4 = strip_tags(Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut facilisis tristique nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Phasellus semper hendrerit lectus. Cras semper diam nec quam. Nam lectus velit, tincidunt vel, interdum sed, lacinia at, lorem. Suspendisse feugiat ligula at justo. Duis velit. Maecenas suscipit ligula eu magna. In vulputate. Proin ullamcorper tincidunt pede. Donec eu metus. Vestibulum adipiscing massa at libero. Duis eu magna. Maecenas eget turpis auctor neque euismod consectetuer. Nunc nisl neque, eleifend nec, laoreet elementum, euismod at, neque. Nulla convallis. In hac habitasse platea dictumst. Cras non dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos.) &foto4 = strip_tags(20051221203729-vida-y-muerte.jpg)&num_filas = 5
</pre></xmp></noscript>
<script language="javascript" src="http://ads.tripod.lycos.es/ad/test_frame_size.js"></script>
<script language="javascript">x6f37e8c46cd = "7f683a26";
if (!AD_clientWindowSize()) {document.write("<NOSC"+"RIPT>");}</script>
<script>displayGoogleAd7f683a26();</script>
<script language="javascript" src="http://ads.tripod.lycos.es/ad/popunder_lycos_update.php?cat=noref&CC=es"></script>
<script type="text/javascript" src="http://ads.tripod.lycos.es/ad/ad.php?cat=noref&mkw=&CC=es&ord=7f683a26&adpref="></script>
<!-- START RedSheriff Measurement V5.01 -->
<!-- COPYRIGHT 2002 RedSheriff Limited -->
<script language="JavaScript" type="text/javascript"><!--
var _rsCI='lycos-es';
var _rsCG='noref';
var _rsDT=1;
var _rsSI=escape(window.location);
var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';
var _rsRP=escape(document.referrer);
var _rsND=_rsLP+'//secure-uk.imrworldwide.com/';
if (parseInt(navigator.appVersion)>=4) {
var _rsRD=(new Date()).getTime();
var _rsSE=0;
var _rsSV='';
var _rsSM=0;
_rsCL='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'v5.js"><\/scr'+'ipt>';
} else {
_rsCL='<img src="'+_rsND+'cgi-bin/m?ci='+_rsCI+'&cg='+_rsCG+'&si='+_rsSI+'&rp='+_rsRP+'">';
}
document.write(_rsCL);
//--></script>
<noscript>
<img src="//secure-uk.imrworldwide.com/cgi-bin/m?ci=lycos-es&cg=noref" alt="">
</noscript>
<script>if (!AD_clientWindowSize()) {document.write("<NOSC"+"RIPT>");}</script>
<!-- END RedSheriff Measurement V5 -->
which I was able to load into a flash movie with:
noticias_lv = new LoadVars();
noticias_lv.onData=function(src){
txt1.text=src;
}
noticias_lv.load("http://usuarios.lycos.es/bywebpruebas/mostrar.php");
stop();
byweb
12-22-2007, 07:50 PM
I am stubborn, do not understand it now it goes out this way
http://www.usuarios.lycos.es/bywebpruebas/news.html
blanius
12-22-2007, 10:26 PM
I was just using the onData to show you that it is indeed working just not quite right...
first off you've got problems in the PHP... You should not be seening strip_tags()
and the bigger problem is that lycos is forcing the google ads into your PHP generated page.
There are ways to work around it but it's a little complicated.
1) Use XMLsocket to send data only, bypassing the normal PHP output.
OR
2) Have your PHP genterate a little different layout and load everything in and in the onData function strip out only what you need.
using loadVars you can get the RAW data as in the link above by using the onData function rather than the onLoad function.
if you can generate the PHP output to be like this:
<data>probando|15/12/2007|heyo perro!!!|Foto 2.jpg
Abtenerse Idiotas|13/12/2007|Este ejemplo solo lo puse para que pudieseis observar como funciona este ejemplo y mejorarlo para los que pudiesen hacerlo. He visto que �amente se utiliza solo para escribir idioteces, pronto lo quitar�Por cierto esta nena esta mu bien....|sho!.jpg</data>
Then you could do this:
http://bretlanius.com/flash/bywebnews.html
with this code
noticias_lv = new LoadVars();
noticias_lv.onData=function(src){
pointer=src.indexOf("<data>");
pointer2=src.lastIndexOf("</data>");
mydata=src.substr(pointer+6,pointer2-6)
records=new Array();
records=mydata.split("\n")
for (idx=0;idx<records.length;idx++){
fields = records[idx].split('|');
txt1.htmlText+="<B>"+fields[0]+"............."+fields[1]+"</B>";
txt1.htmlText+="<img src='http://usuarios.lycos.es/bywebpruebas/fotos/"+fields[3]+"' width='200' height='150' align='right'>"
txt1.htmlText+="<i>"+fields[2]+"</i><p><br><br><br><br><br><br>"
}
}
byweb
12-23-2007, 07:41 AM
I have used the system of news with XML and CSS, but in this work the client wants to modify it, because of it I have thought in php, I had an application that was generating a news in php and the only thing that it is to give exit in flash. If you have noticed in
http://usuarios.lycos.es/bywebpruebas/
it can introduce the information, then this news And then it goes out generated in to show news. You can try it if yuu wish it. I am going to try your code.Thank you.
byweb
12-23-2007, 08:13 AM
I¨m sorry, but it doesn´t work. Thank for you lessons. I am learning much.
http://usuarios.lycos.es/bywebpruebas/news.html
note: The php file I help me to build NECROMANTHUS. (http://forum.necromanthus.com/necroforum.php?forum=2&topic=179)
blanius
12-23-2007, 08:56 AM
Your PHP is still wrong...
for my code to work you must have your PHP output as I showed
<data>probando|15/12/2007|heyo perro!!!|Foto 2.jpg
Abtenerse Idiotas|13/12/2007|Este ejemplo solo lo puse para que pudieseis observar como funciona este ejemplo y mejorarlo para los que pudiesen hacerlo. He visto que �amente se utiliza solo para escribir idioteces, pronto lo quitar�Por cierto esta nena esta mu bien....|sho!.jpg</data>
right now you still have the PHP doing:
&titulo0 = strip_tags(probando) &fecha0 = strip_tags(15/12/2007)&mensaje0 = strip_tags(heyo perro!!!) &foto0 = strip_tags(Foto 2.jpg)&titulo1 = strip_tags(Abtenerse Idiotas) &fecha1 = strip_tags(13/12/2007)&mensaje1 = strip_tags(Este ejemplo solo lo puse para que pudieseis observar como funciona este ejemplo y mejorarlo para los que pudiesen hacerlo. He visto que últimamente se utiliza solo para escribir idioteces, pronto lo quitaré. Por cierto esta nena esta mu bien....) &foto1 = strip_tags(sho!.jpg)&titulo2 = strip_tags(prueba 3) &fecha2 = strip_tags(13/12/2007)&mensaje2 = strip_tags(Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut facilisis tristique nisi. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Phasellus semper hendrerit lectus. Cras semper diam nec quam. Nam lectus velit, tincidunt vel, interdum sed, lacinia at, lorem. Suspendisse feugiat ligula at justo. Duis velit. Maecenas suscipit ligula eu magna. In vulputate. Proin ullamcorper tincidunt pede. Donec eu metus. Vestibulum adipiscing massa at libero. Duis eu magna. Maecenas eget turpis auctor neque euismod consectetuer. Nunc nisl neque, eleifend nec, laoreet elementum, euismod at, neque. Nulla convallis. In hac habitasse platea dictumst. Cras non dui. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per in
byweb
12-23-2007, 09:20 AM
Then I have to change the file .php that generates this to mostrar.php that is this:<?
/*****Creado por: hheroedeleyenda@hotmail.com*****/
/* ginitofl */
/* Gino Flores Lopez */
$server="localhost"; /* Nuestro server mysql: */
$database="noticias"; /* Nuestra base de datos */
$dbpass=""; /*Nuestro password */
$dbuser=""; /* Nuestro user */
//datos del arhivo
$nombre_archivo = $HTTP_POST_FILES["userfile"]["name"];
$tipo_archivo = $HTTP_POST_FILES["userfile"]["type"];
$tamano_archivo = $HTTP_POST_FILES["userfile"]["size"];
//compruebo si las características del archivo son las que deseo
if (!((strpos($tipo_archivo, "gif") || strpos($tipo_archivo, "jpeg")) && ( $tamano_archivo < 500000)))
{
echo "La extensión o el tamaño de los archivos no es correcta. <br><br><table><tr><td><li>Se permiten archivos .gif o .jpg<br><li>se permiten archivos de 100 Kb máximo.</td></tr></table>";
?>
<script language="javascript">
setTimeout("url()",3000);
function url()
{
window.history.back();
}
</script>
<?
}
else
{
$nom_img= $nombre_archivo;
$directorio = 'fotos/';
if (move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'],$directorio . "/" . $nom_img))
{
$diaactual= date("d");
$mesactual= date("m");
$anoactual= date("Y");
$fecha= $diaactual . "/" . $mesactual . "/" . $anoactual;
//NOS CONECTAMOS A LA BASE DE DATOS
$link=mysql_connect($server,$dbuser,$dbpass);
$query="INSERT INTO noticias (titulo,mensaje,foto,fecha) VALUES ('$titulo','$mensaje','$nom_img','$fecha')";
$result=mysql_db_query($database,$query,$link);
if(mysql_affected_rows($link))
{
echo "Noticia ingresada correctamente";
?>
<table width="50%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td> <p align="left"><b><font face="Arial" color="#FF0000"><a href="muestranoticia.php">Ver Noticias</a></td>
</tr>
</table>
<?
} else
{
echo "Error introduciendo la Noticia";
} /* Cierre del else */
}
else
{
echo "error al subir la foto";
}
}
?>
for generates your code but I don´t to do it. Help me please....
blanius
12-23-2007, 03:17 PM
That looks like the PHP for inserting a new record. The code in your first post looks like what you are using.
Anyway here is the code form your first post modified.
<?php
$conn = mysql_connect("localhost","","");
mysql_select_db("es_db",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
echo ("<data>");
while ($damefila=mysql_fetch_object($resultid)) {
echo strip_tags($damefile->titulo."|");
echo strip_tags($damefila->fecha."|");
echo strip_tags($damefile->mensaje."|");
echo (damefila->foto."|");
$n++;
}
echo "</data>";
?>
blanius
12-23-2007, 03:21 PM
The trick here is that lycos is adding to what the PHP is sending to the browser which makes a mess of things. What we are doing is bypassing that by formatting the data in a way we can find it by wrapping it in <data></data> tags. Then we format the data in single lines that we can pull apart into arrays fairly easy in flash.
byweb
12-23-2007, 10:00 PM
I´m sorry but it doen´t work. Lycos I use only to prove it. Thanks.
http://usuarios.lycos.es/bywebpruebas/mostrar.php
blanius
12-23-2007, 10:37 PM
typo error
<?php
$conn = mysql_connect("localhost","","");
mysql_select_db("es_db",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
echo ("<data>");
while ($damefila=mysql_fetch_object($resultid)) {
echo strip_tags($damefile->titulo."|");
echo strip_tags($damefila->fecha."|");
echo strip_tags($damefile->mensaje."|");
echo ($damefila->foto."|");
$n++;
}
echo "</data>";
?>
It's easy to miss when I can't test the code.
blanius
12-23-2007, 10:38 PM
If the site is not going to be on lycos server then I would not test my PHP/flash there as they make it not work so well by pushing ads into the server response. You would not have to do some of this on paid hosting.
blanius
12-23-2007, 10:41 PM
If you're going to offer PHP as part of sites you might want to take some time and learn it. It's not very hard to master. A glance at the code should have been obvious that I just left a "$" off the variable name and the error code tells what line to look on.
Writing the PHP code for you is a little out of line for a support forum for koolmoves.
byweb
12-25-2007, 07:48 PM
Nothing , it does not work that not to do, only I want that at least me it works like to you. Thanks.
blanius
12-26-2007, 11:37 AM
The last code should work.
byweb
12-26-2007, 03:12 PM
I sorry for bothering so much, but that I cannot happening, now I have the page is at a server of payment, have verified that the information is recorded in the database, but when I execute mostrar.php (http://www.tvdigitalalgaidas.com/news/mostrar.php) in the browser, only me there appear the images guarded in the database and the date, but does not show titulo and does not show mensaje.
For it I believe that it does not show me the results in news (http://www.tvdigitalalgaidas.com/news/news.html), or possibly it is not well my file . fun (http://www.tvdigitalalgaidas.com/news/news2.fun)
Thank you again for your amiability.
blanius
12-26-2007, 03:51 PM
it's hard to debug the PHP code without access to the sever but try this.
<?php
$conn = mysql_connect("localhost","","");
mysql_select_db("es_db",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
echo ("<data>");
while ($damefila=mysql_fetch_object($resultid)) {
echo strip_tags($damefile->titulo)."|";
echo strip_tags($damefila->fecha)."|";
echo strip_tags($damefile->mensaje)."|";
echo ($damefila->foto)."|";
$n++;
}
echo "</data>";
?>
byweb
01-29-2008, 02:17 PM
I have returned to be employed at this topic after a period of stop for work. I have corrected the code PHP, now I have the example in localhost (AppServer) and it continues without working.
The code php is this:
<?php
$conn = mysql_connect("localhost","root","pablo1967");
mysql_select_db("noticias",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
echo ("<data>");
while ($damefila=mysql_fetch_object($resultid)) {
echo strip_tags($damefila->titulo."|");
echo strip_tags($damefila->fecha."|");
echo strip_tags($damefila->mensaje."|");
echo ($damefila->foto."|");
$n++;
}
echo "</data>";
?>
And the code AS:
noticias_lv = new LoadVars();
noticias_lv.onData=function(src){
pointer=src.indexOf("<data>");
pointer2=src.lastIndexOf("</data>");
mydata=src.substr(pointer+6,pointer2-6)
records=new Array();
records=mydata.split("\n")
for (idx=0;idx<records.length;idx++){
fields = records[idx].split('|');
txt1.htmlText+="<B>"+fields[0]+"............."+fields[1]+"</B>";
txt1.htmlText+="<img src='fotos'"+fields[3]+"' width='200' height='150' align='right'>"
txt1.htmlText+="<i>"+fields[2]+"</i><p><br><br><br><br><br><br>"
}
}
My question is where it searches the file php, if it in the code AS doesn´t exist ?
no exist in AS:
noticias_lv.load("mostrar.php");
can it to be this the motive? Thanks.
blanius
01-29-2008, 08:09 PM
Yes
Always verify that the PHP is working first. Run the PHP file and make sure it's echoing what you expect.
Then debug the AS.. But yes that line would seem to be missing.
byweb
01-30-2008, 12:29 PM
If already I have checked the exit of the PHP and it works well at least I believe it, the exit is the following one:
<data>Pablo|26/12/2007|erereqreqrqerqerqerrqemnmdavd nvmdv dsvm,sdv dsmvna dsavmnd vmdsvn dsmvds vmdsvnsd.vn .dsvd|dianaNavarro.jpg|reqr|26/12/2007|erereqreqrqerqerqerrqe|sho!.jpg|reqr|26/12/2007|erereqreqrqerqerqerrqe|sho!.jpg|sdS|23/12/2007|ssSs SLKhs HSJKH sh Sajhsj HSJh shJSHj shjk JHSJKhs JSHsuiy SJKH ljshlKJHS hsoIUSY ljhslkjHSLuihs HLKJSH shLUIKSH hsklHLKSJHkss|imag1.jpg|</data>
But not now that fails in the code AS in order that it shows the content of the file PHP.
Thanks for yor response again.
blanius
01-30-2008, 06:19 PM
in the onData try putting the variable src into a simple textfield and you should see the raw data just like above.
I know I tried this AS code on sample data and it worked.
blanius
01-30-2008, 06:41 PM
Ok here's what's up....
I made a mistake in the AS I used substr instead of substring they are similar but work a little different.
Second I assume in the AS code that Each record will be on a new line so just add change the PHP to be:
<?php
$conn = mysql_connect("localhost","root","pablo1967");
mysql_select_db("noticias",$conn);
$ssql = "SELECT * FROM noticias";
$ssql .= " ORDER BY id desc";
$resultid = mysql_query($ssql,$conn);
$n = 0;
echo ("<data>");
while ($damefila=mysql_fetch_object($resultid)) {
echo strip_tags($damefila->titulo."|");
echo strip_tags($damefila->fecha."|");
echo strip_tags($damefila->mensaje."|");
echo ($damefila->foto."|"."\n");
$n++;
}
echo "</data>";
?>
and the AS to be
noticias_lv = new LoadVars();
noticias_lv.onData=function(src){
pointer=src.indexOf("<data>");
pointer2=src.indexOf("</data>");
mydata=src.substring(pointer+6,pointer2-6)
records=new Array();
records=mydata.split("\n")
for (idx=0;idx<records.length;idx++){
fields = records[idx].split('|');
txt1.htmlText+="<B>"+fields[0]+"............."+fields[1]+"</B>";
txt1.htmlText+="<img src='fotos'"+fields[3]+"' width='200' height='150' align='right'>"
txt1.htmlText+="<i>"+fields[2]+"</i><p><br><br><br><br><br><br>"
}
}
noticias_lv.load("http://usuarios.lycos.es/bywebpruebas/mostrar.php")
blanius
01-30-2008, 06:42 PM
You've got to debug step by step to find where the problem is.
byweb
01-31-2008, 07:54 AM
Thank you Mr. Blainus, now it seems that it begins to work, only it is necessary if it shows the images, I was looking for possible mistakes to seeing if I can repair it.
Can you see here (http://usuarios.lycos.es/bywebpruebas/news.html)
blanius
01-31-2008, 10:51 AM
almost there....
It's working here with this code....
noticias_lv = new LoadVars();
noticias_lv.onData=function(src){
pointer=src.indexOf("<data>");
pointer2=src.indexOf("</data>");
mydata=src.substring(pointer+6,pointer2-6)
records=new Array();
records=mydata.split("\n")
for (idx=0;idx<records.length;idx++){
fields = records[idx].split('|');
txt1.htmlText+="<B>"+fields[0]+"............."+fields[1]+"<br/>";
txt1.htmlText+="<img src='http://usuarios.lycos.es/bywebpruebas/fotos/"+fields[3]+"' width='200' height='150' align='left'/>"
txt1.htmlText+="<i>"+fields[2]+"</i><p><br><br><br><br><br><br><br><br>"
txt1.htmlText+="----------------------------------------------------------------------------"
}
}
noticias_lv.load("http://usuarios.lycos.es/bywebpruebas/mostrar.php")
byweb
01-31-2008, 02:02 PM
Uaooh, thats is fantastic, Thank´s Mr. Blainus. It works well now here (http://usuarios.lycos.es/bywebpruebas/news.html). Thank Again for your help and time.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.