RE: Showing all mysql query results!

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

 




check out

www.phpforflash.com
or
www.flashkit.com

bastien

From: Juan Stiller <juanstiller@xxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: RE:  Showing all mysql query results!
Date: Mon, 18 Oct 2004 15:24:53 -0300 (ART)

Ok, i just followed your advice for make the code
easier to read, it looks good, and yes it works ok
too.

I´ve tried it, and yes it shows more than 1 entry, but
i cant make flash to show them, im sure something on
flash must be wrong or missing, there is no fault on
the php code, so i might research a little more on the
flash part.

Do you know some good tutorial for this?

Thanks for your response.


Juan.


--- "Norland, Martin" <Martin.Norland@xxxxxxxxxx> escribió: > > A quick glance says that's all perfectly right, I > would run the query on the mysql command line to be > sure it's really giving more than 1 result - but I > can suggest two things: > > 1) be sure to mysql_free_result($result) afterwards > if you're done with the query but your script will > still be doing anything. You really do want to do > that because it tells mysql you're done with that so > it can release the memory - PHP doesn't actually use > the memory for that resultset, it just holds a > result id that it uses to get the results from mysql > (so best to let mysql have its memory back as soon > as you're done). > > 2) you will save yourself a fair amount of effort > and readability, if you don't need those variables > other than to print, to change things like so: > --------------- > $apellido=$row["apellidoclientesnuevos"]; > echo "&Apellido=$apellido"; > --- becomes --- > echo "&Apellido={$row['appellidoclientesnuevos']}"; > --------------- > (you don't need to use ', " works too - I find ' > more legible here) > > This may also reduce confusion if you start thinking > that the database field is holding just names, > instead of names of new clients (e.g. you > accidentally paste it elsewhere for use and keep > pulling only from the new clients table). > > Are you perhaps storing clients in that table > temporarily, so it rarely has many clients in it? > That could explain the behaviour as well. > > - Martin Norland, Database / Web Developer, > International Outreach x3257 > The opinion(s) contained within this email do not > necessarily represent those of St. Jude Children's > Research Hospital. > > > -----Original Message----- > From: Juan Stiller [mailto:juanstiller@xxxxxxxxxxxx] > > Sent: Monday, October 18, 2004 11:07 AM > To: php-db@xxxxxxxxxxxxx > Subject: Showing all mysql query results! > > > Hi, im using this script, to show all entrys of a > mysql database on a flash movieclip, but i was told > at > flash forums, that this code is not ok, because its > showing only the last entry not all of them, maybe > you > someone can recommend what to add to this little > script?. > > > <?php > $conn = @mysql_connect("***", "***", "****"); > > if (!$conn) { > echo( "<P>No se pudo conectar " . > "al servidor MySQL.</P>" ); > exit(); > } > > if (! @mysql_select_db("clientes") ) { > echo( "<P>No se puede encontrar " . > "la base de datos clientes!</P>" ); > exit(); > } > > // Request all data > $result1 = mysql_query("select * from > clientesnuevos"); > > print "Results="; > echo "<h1>Clientes agregados:</h1><br>"; > > while($row=mysql_fetch_array($result1, MYSQL_ASSOC)) > { > $id=$row["id"]; > echo "&Id=$id"; > $apellido=$row["apellidoclientesnuevos"]; > echo "&Apellido=$apellido"; > > $nombre=$row["nombreclientesnuevos"]; > echo "&Nombre=$nombre"; > > $dni=$row["dniclientesnuevos"]; > echo "&Dni=$dni"; > > $telefono=$row["telefonoclientesnuevos"]; > echo "&Telefono=$telefono"; > > $dia=$row["diacitaclientesnuevos"]; > echo "&Dia=$dia"; > > $mes=$row["mescitaclientesnuevos"]; > echo "&Mes=$mes"; > > $ano=$row["anocitaclientesnuevos"]; > echo "&Ano=$ano"; > > $hora=$row["horacitaclientesnuevos"]; > echo "&Hora=$hora"; > > $minutos=$row["minutoscitaclientesnuevos"]; > echo "&Minutos=$minutos"; > > $abogado=$row["abogadoclientesnuevos"]; > echo "&Abogado=$abogado"; > > $asunto=$row["asuntoclientesnuevos"]; > echo "&Asunto=$asunto"; > > $donde=$row["dondeclientesnuevos"]; > echo "&Donde=$donde"; > } > ?> > > Thanks > Emilio > > > > > > > ___________________________________ > ¡Llevate a Yahoo! en tu Unifón! > Ahora podés usar Yahoo! Messenger en tu Unifón, en > cualquier momento y lugar. > Encontrá más información en: > http://ar.mobile.yahoo.com/sms.html > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

Correo Yahoo! - 6 MB, tecnología antispam ¡gratis!
 Suscribite ya http://correo.yahoo.com.ar/

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


-- 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