MySQL query result with some errors!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Im trying to get a query result from mysql database to
show it on a flash animation, so far i have this code
that its supposed to connect to mysql server , make
the query and get the results, store them on variables
so that flash can read them. Basically i have these
main fileds like : lastname, firstname and so on... a
guy here told me correctly that i should in case to
have more than one entry on the database, use the
output like lastname1, lastname2, etc. I gues this
code is doing that, but when i want to show that info
on flash i get eg:

lastname: smithn=0
lastname: jacksonn=1

when it should be 
lastname: smith
lastname: jackson
...
...


So i guess im doing something wrong, can someone point
me in the right direcction??

Here is the php code:

<?php
$conn = @mysql_connect("localhost", "mysql",
"ullneverguessit");

if (!$conn) {
echo( "<P>No se pudo conectar " .
"al servidor MySQL.</P>" );
exit();
}

if (! @mysql_select_db("llamadas") ) {
echo( "<P>No se puede encontrar " .
"la base de datos clientes!</P>" );
exit();
}
////////////////////////////////////////////////////////////////////////////////
$qr = mysql_query("select * from datos");
$nrows =
mysql_num_rows($qr);
$rString = "n=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rstring .= "&Id".$i."=".$row['id'];
$rString .=
"&Dia".$i."=".$row['dia']."&Mes".$i."=".$row['mes']."&Ano".$i."=".$row['ano'];
$rString .=
"&Hora".$i."=".$row['hora']."&Minutos".$i."=".$row['minutos'];
$rString .= "&Receptor".$i."=".$row['receptor'].
$rString .=
"&Destinatario".$i."=".$row['destinatario'].
$rString .= "&Apellido".$i."=".$row['apellido'].
$rstring .= "&Nombre".$i."=".$row['nombre'];
$rstring .= "&Telefono".$i."=".$row['telefono'];
$rstring .= "&Asunto".$i."=".$row['asunto'];
}
echo $rString;
mysql_free_result($qr); 
?>

Thanks.
Juan


	


	
		
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux