Hola a todos, la duda que tengo es que, hace poco cree un chat simple para mi sitio, pero cuando se mandan cierta cantidad de mensajes, algunos no salen ya que la tabla es chica. Ej: http://k32.kn3.net/F/7/A/8/9/6/AF1.jpg
Supuestamente tendria que haber una barra para bajar o subir creo yo...
Aca les dejo los codigos, estan las paginas mensajes.php, chat.php y ejecucion.php
chat.php
Editado
Supuestamente tendria que haber una barra para bajar o subir creo yo...
Aca les dejo los codigos, estan las paginas mensajes.php, chat.php y ejecucion.php
chat.php
<table width="615" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><iframe src="mensajes.php" width="615" height="450" scrolling="no" id="chatt"></iframe></td>
</tr>
<tr>
<td align="center"><form id="form1" name="form1" method="post" action="ejecucion.php">
<label></label>
<label></label>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="359"><label>
<input name="alias" id="nombrr" placeholder="Escribe tu alias" value="<?php echo $row_Recordset1['nombre']; ?>" size="20" readonly="readonly" />
</label></td>
</tr>
<tr>
<td><input name="mensaje" type="text" id="nombrar" size="40" maxlength="250" x-webkit-speech placeholder="Escribe un Mensaje" />
<input name="Submit" type="submit" id="agrr" value="Enviar" /></td>
</tr>
</table>
</form></td>
</tr>
</table>ejecucion.php<?php
$mensaje=$_POST['mensaje'];
$alias=$_POST['alias'];
$ip=$_SERVER['REMOTE_ADDR'];
$fecha=date("h:i:s");
if($alias!="" and $mensaje!=""){
mysql_connect("localhost","root", "**********");
mysql_select_db("sitio_corporativo");
mysql_query("insert into mensajes(alias,mensaje,ip,fecha) values('$alias','$mensaje','$ip','$fecha')");
$conteo=mysql_query("select count(*) from mensajes group by id");
$primero=mysql_query("select min(id) from mensajes");
$repri=mysql_result($primero,0);
$registros=mysql_num_rows($conteo);
if($registros>150){
mysql_query("delete from mensajes where id=$repri");
}
}
header("Location:chat.php?al=$alias");
?>
mensajes.php<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_conexion, $conexion);
$query_Recordset1 = "SELECT z_users.nombre FROM z_users";
$Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_connect("localhost","root", "pitodesaul");
mysql_select_db("sitio_corporativo");
//echo "<META HTTP-EQUIV='refresh' CONTENT='0; URL=mensajes.php'>";
header('refresh:2; url=mensajes.php');
?>
<link href="michat.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
-->
</style><table width="202" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="202">
<p>
<?php
$re=mysql_query("select * from mensajes order by id asc");
while($f=mysql_fetch_array($re)){
echo "<scpan class='usuario'></span>".$f['alias'].": <span class='mensaje'>".htmlentities($f['mensaje'])."
<br/>
<span class='fecha'>".$f['fecha']."</span></span><br>
<span class='lin'>_________________________________________________________________</span>
";
}
?>
</p>
<p> </p></td>
</tr>
</table>
<?php
mysql_free_result($Recordset1);
?>
Si necesitan alguna otra informacion solo pidanla, desde ya muchas gracias!!Editado
5
Puntos
Puntos
1707
Visitas
Visitas
2
Resp
Resp
Por georgeharrison hace 11 años
Novice
Respuesta #1
buenas GeorgeH solo tienes que usar un poco de css en este tema te explico como se hace con un ejemplo muy práctico
https://phpres.net/php-poo/como-crear-contenedor-div-con-scroll-vertical
https://phpres.net/php-poo/como-crear-contenedor-div-con-scroll-vertical
0
Puntos
Puntos
Por alber hace 11 años
Admin
Respuesta #2
Otra vez muchisimas gracias alber, la verdad que sos un genio, simpre muy atento!
0
Puntos
Puntos
Por georgeharrison hace 11 años
Novice