[PHP-DB] Re: Showing various result from a mysql query
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 <[EMAIL PROTECTED]> Date: Thu, 29 Sep 2005 20:11:27 + (GMT) To: php-db@lists.php.net 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: No se pudo conectar " . "al servidor MySQL." ); exit(); } if (! @mysql_select_db("llamadas") ) { echo( "No se puede encontrar " . "la base de datos clientes!" ); 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
Re: [PHP-DB] Re: Showing various result from a mysql query
Hi anna, Thanks for the suggestion, but it didn't worked, when i try it on the browser, it ask me if i want to download , open the file. Any other sugg? --- annA <[EMAIL PROTECTED]> escribió: > 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 <[EMAIL PROTECTED]> > Date: > Thu, 29 Sep 2005 20:11:27 + (GMT) > To: > php-db@lists.php.net > > 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: > > $conn = @mysql_connect("localhost", "blah", > "blah23"); > > if (!$conn) { > echo( "No se pudo conectar " . > "al servidor MySQL." ); > exit(); > } > > if (! @mysql_select_db("llamadas") ) { > echo( "No se puede encontrar " . > "la base de datos clientes!" ); > 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
Re: [PHP-DB] Re: Showing various result from a mysql query
Yes, that sounds correct, when flash requests the page directly, it will realize it's URLEncoded (or should) and read the variables correctly. Your browser on the other hand isn't built to display this information, so it wants you to tell it where to save it. -Micah On Tuesday 04 October 2005 9:43 am, Juan Stiller wrote: > Hi anna, > > Thanks for the suggestion, but it didn't worked, when > i try it on the browser, it ask me if i want to > download , open the file. > > Any other sugg? > > --- annA <[EMAIL PROTECTED]> escribió: > > 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 <[EMAIL PROTECTED]> > > Date: > > Thu, 29 Sep 2005 20:11:27 + (GMT) > > To: > > php-db@lists.php.net > > > > 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&Nombre >0=cristian&Destinatario0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Di >a0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Receptor0=marilun=1&Hora0=17:30:43&A >pellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Destinatar >io0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=200 >5&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: > > > > > $conn = @mysql_connect("localhost", "blah", > > "blah23"); > > > > if (!$conn) { > > echo( "No se pudo conectar " . > > "al servidor MySQL." ); > > exit(); > > } > > > > if (! @mysql_select_db("llamadas") ) { > > echo( "No se puede encontrar " . > > "la base de datos clientes!" ); > > 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
Re: [PHP-DB] Re: Showing various result from a mysql query
Hi Juan, Micah is correct. You must try it in the Flash environment. As I was lazy and didn't want to check all your php, I created a simple test file from your mail: 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 Flash read it & seemed to parse the variables just fine. That indicates that your php output is well-formed from the Flash point of view - well in the example given anyway! ;) If, after adding the header, you still have problems reading in the data in the example then the problem is more likely in the actionscript. hth, anna --- Micah Stevens wrote: Yes, that sounds correct, when flash requests the page directly, it will realize it's URLEncoded (or should) and read the variables correctly. Your browser on the other hand isn't built to display this information, so it wants you to tell it where to save it. -Micah On Tuesday 04 October 2005 9:43 am, Juan Stiller wrote: > Hi anna, > > Thanks for the suggestion, but it didn't worked, when > i try it on the browser, it ask me if i want to > download , open the file. > > Any other sugg? > > --- annA <[EMAIL PROTECTED]> escribi�: > > 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 <[EMAIL PROTECTED]> > > Date: > > Thu, 29 Sep 2005 20:11:27 + (GMT) > > To: > > php-db@lists.php.net > > > > 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&Nombre >0=cristian&Destinatario0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Di >a0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Receptor0=marilun=1&Hora0=17:30:43&A >pellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Destinatar >io0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=200 >5&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: > > > > > $conn = @mysql_connect("localhost", "blah", > > "blah23"); > > > > if (!$conn) { > > echo( "No se pudo conectar " . > > "al servidor MySQL." ); > > exit(); > > } > > > > if (! @mysql_select_db("llamadas") ) { > > echo( "No se puede encontrar " . > > "la base de datos clientes!" ); > > 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, visi
Re: [PHP-DB] Re: Showing various result from a mysql query
Hi Juan I'd put it at the beginning of the php script if it's always going to be sending its data to Flash, and certainly before ANY output: http://uk2.php.net/manual/en/function.header.php By the way the mysql-related error messages in your script such as "No se pudo conectar al servidor MySQL." aren't going to be shown in Flash as there's no "variable=". It looks like the code was used for sending html to a browser and is in the process of being adapted for Flash. Not too far to go now... anNa Juan Stiller wrote: Hi Anna: I feel kinda stupid, asking the same thing more than twice, but should i add: On the php script? or on the as code of the animation?? Thanks for the patience and the help. Juan. --- annA <[EMAIL PROTECTED]> escribió: Hi Juan, Micah is correct. You must try it in the Flash environment. As I was lazy and didn't want to check all your php, I created a simple test file from your mail: 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 Flash read it & seemed to parse the variables just fine. That indicates that your php output is well-formed from the Flash point of view - well in the example given anyway! ;) If, after adding the header, you still have problems reading in the data in the example then the problem is more likely in the actionscript. hth, anna --- Micah Stevens wrote: Yes, that sounds correct, when flash requests the page directly, it will realize it's URLEncoded (or should) and read the variables correctly. Your browser on the other hand isn't built to display this information, so it wants you to tell it where to save it. -Micah On Tuesday 04 October 2005 9:43 am, Juan Stiller wrote: > Hi anna, > > Thanks for the suggestion, but it didn't worked, when > i try it on the browser, it ask me if i want to > download , open the file. > > Any other sugg? > > --- annA <[EMAIL PROTECTED]> escribi�: > > 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 <[EMAIL PROTECTED]> > > Date: > > Thu, 29 Sep 2005 20:11:27 + (GMT) > > To: > > php-db@lists.php.net > > > > 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&Nombre 0=cristian&Destinatario0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Di a0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Receptor0=marilun=1&Hora0=17:30:43&A pellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=2005&Nombre0=cristian&Destinatar io0=martan=1&Hora0=17:30:43&Apellido0=garofalo&Id0=6&Dia0=28&Mes0=9&Ano0=200 >5&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: > > > > > $conn = @mysql_connect("localhost", "blah", > > "blah23"); > > > > if (!$conn) { > > echo( "No se pudo conectar " . > > "al servidor MySQL." ); > > exit(); > > } > > > > if (! @mysql_select_db("llamadas") ) { > > echo( "No se puede encontrar " . > > "la base de datos clientes!" ); > > 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[