Ver Mensaje Individual
  #5 (permalink)  
Antiguo 19/12/2008, 13:22
Xematick
 
Fecha de Ingreso: octubre-2008
Mensajes: 180
Antigüedad: 15 años, 6 meses
Puntos: 1
Respuesta: importa texto desde base datos.

gracias
Código PHP:
<body>
<form id="form1" name="form1" method="post" action="">
  <label>Sala Chat
  <textarea name="textarea" cols="24" rows="15" ><?php
$conexion
=mysql_connect("localhost","+++","+++")  
  or  die(
"Problemas en la conexion");
mysql_select_db("aerotechdb",$conexion
  or  die(
"Problemas en la selección de la base de datos");
$registros=mysql_query("select TimePrint, nick, mensaje from tblMensajes WHERE mensaje!='' ORDER BY IDMensaje DESC LIMIT 3",$conexion) or

  die(
"Problemas en el select:".mysql_error());
while (
$reg=mysql_fetch_array($registros))
{
$UN_SALTO="\r\n"
$DOS_SALTOS="\r\n\r\n"
  echo 
$reg['TimePrint'].$UN_SALTO;
  echo 
$reg['nick'].":".$UN_SALTO;
  echo 
$reg['mensaje'].$DOS_SALTOS;
  switch (
$reg['TimePrint']) {
    case 
1:echo "PHP";
           break;
    case 
2:echo "ASP";
           break;
    case 
3:echo "JSP";
           break;
  }
}
mysql_close($conexion);
?></textarea>
  </label>
</form>
</body>