Re: Showing various result from a mysql query

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

 



Hi Juan,

I haven't read the list for a 'few' days so I'm sorry if you've been sweating over this, but if you haven't yet solved it then make sure you send a

Header("Content-type: application/x-www-urlform-encoded");

before your

echo $rString;

annA

----------------------------------------------------------------------------
Subject:
Showing various result from a mysql query
From:
Juan Stiller <juanstiller@xxxxxxxxxxxx>
Date:
Thu, 29 Sep 2005 20:11:27 +0000 (GMT)
To:
php-db@xxxxxxxxxxxxx

Hi, im working on a php file that its supposed to
retrieve data from a mysql database, to send it to a
flash animation to show the results. Thing is that im
testing some modifications to the code, so if there is
more than one entry, it shows all the results.

For some reason probably a mistake on the code im
getting this output when i try the muestra.php file on
the browser:

n=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Destinatario0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Receptor0=marilun=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Destinatario0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian

This might not be wrong, but when i show info on the
flash animation i get eg:

Apellido0=garofalo , i dont want to get the n=x on the
output, its supposed to be just an internal thing to
tell flash that for the variable Apellido(lastname)
there is more than one result and then to show all of
them.


This is the php code:

<?php
$conn = @mysql_connect("localhost", "blah", "blah23");

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);
?>

Also, i was told that including password and user to
connect to mysql server sholdn´t be shown on the php
file, so i have to use include_one and the file, but i
don´t know exaclty the syntax, can anybody help me
with it?

Thanks in advance.



	


	
		
___________________________________________________________
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