Fixing this code to show all variables!

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

 



Hi, im trying to use this code to send a query to a
mysql database, and then display the query results and
put the results on variables, the problem is that i
don´t know how to make it so that if there is more
than one result, it uses xvariables as results are,
using this script just like it is, if its more than
one result it overwrite the variable with the last
result. Someone told me to use an array, but i dont
have any idea how.

Can you help me?

THis is the script:
<?php
$conn = @mysql_connect("90.0.0.2", "javier",
"315/95");

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))
{
echo "&Id={$row['id']}";
echo "&Apellido={$row['apellidoclientesnuevos']}";
echo "&Nombre={$row['nombreclientesnuevos']}";
echo "&Dni={$row['dniclientesnuevos']}";
echo "&Telefono={$row['telefonoclientesnuevos']}";
echo "&Dia={$row['diacitaclientesnuevos']}";
echo "&Mes={$row['mescitaclientesnuevos']}";
echo "&Ano={$row['anocitaclientesnuevos']}";
echo "&Hora={$row['horacitaclientesnuevos']}";
echo "&Minutos={$row['minutoscitaclientesnuevos']}";
echo "&Abogado={$row['abogadoclientesnuevos']}";
echo "&Nombre={$row['nombreclientesnuevos']}";
echo "&Asunto={$row['asuntoclientesnuevos']}";
echo "&Donde={$row['dondeclientesnuevos']}";
}
mysql_free_result($result1);
?>

Thanks
Juan


	

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


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

  Powered by Linux