-
it's hard to debug the PHP code without access to the sever but try this.
Code:
<?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>";
?>
-
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:
Code:
<?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:
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='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:
Code:
noticias_lv.load("mostrar.php");
can it to be this the motive? Thanks.
-
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.
-
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:
PHP Code:
<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.
-
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.
-
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:
Code:
<?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
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]+"</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")
-
You've got to debug step by step to find where the problem is.
-
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
-
almost there....
It's working here with this code....
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")
-
Uaooh, thats is fantastic, Thank´s Mr. Blainus. It works well now here. Thank Again for your help and time.