Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/08/2008, 21:41
gdtitm
 
Fecha de Ingreso: agosto-2008
Mensajes: 3
Antigüedad: 16 años, 6 meses
Puntos: 0
Mi base de datos me guarda información incompleta

Pues como les decía tengo problemas al guardar datos en mi BBDD, cuando pongo cadenas cortas todo marcha bien, pero si intento meter una cadena relativamente larga, no me la guarda completa, si pongo un retardo a veces funciona, pero tiene que ser muy largo y en función de la cantidad de texto. Bueno, publico los códigos que tengo.

Primero el archivo index.php


Código:
<?PHP 
ob_start();
//Si se ha hecho click en submit
if (isset($_GET['submit'])){

	include "conectar.php"; //Conectamos a la base de datos
	
	$nick=$_GET['nick'];
	$email=$_GET['email'];
	$comments=$_GET['comments'];
	$sql = "INSERT INTO usuarios (nick, email, comments, date) VALUES('$nick','$email', '$comments', NOW())";
	mysql_query ($sql, $conexion) or die ("<br>Fallo al introcir valores a la tabla");
	
	include "cerrar.php"; //Se cierra la conexión
	//Esta parte no la estoy utilizando por el momento
	/*echo "<script language= \"JavaScript\">
         alert('Gracias');
       	</script>";*/
	echo 'Espera un momento, tu comentario está siendo agregado a la base de datos' ;
	header("Refresh: 5; URL=index.php");
		
	}
else{
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sistema de comentarios</title>
</head>
<!--Aquí empieza el formulario del comentario -->
<body>
<table border="0">
	<tr>
		<td valign="top">
		Nick<br /><br />
		e-mail<br />
		<font size="-5">* no será publicado</font><br /><br />
		Comentarios<br /><br />
		</td>
		<td>
		<!--Estos son los campos a llenar para el comentario -->
		<form action="<?php $PHP_SELF; ?>" method="get" dir="ltr" lang="es" >
		<input type="text" name="nick" size="25"  /><br /><br />
		<input type="text" name="email" size="25" /><br /><br />
		<textarea name="comments" cols="30" rows="5" lang="es"></textarea><br /><br />
		<input type="submit" value="Enviar" name="submit"/>
		<input type="reset" value="Limpiar"
		</form>
		</td>
	</tr>
</table>

<table border="0" width="500">	
<tr>
	<td>
		<?php
		//Mostramos los datos alojados en la BBDD
		include "conectar.php";
		$show = "select DATE_FORMAT(date,'%d-%m-%Y a las %H:%i') as fecha, nick, email, comments from usuarios order by date desc";
		$resultados = mysql_query($show,$conexion);
		?>
		
		
		<?
		while($row = mysql_fetch_array($resultados))
		{
		$nick=$row["nick"].'<br>';
		?>
		<b><font size="+1" color="#0000FF">
		<?
		echo $nick;
		?>
		</font></b>
		
		<img src="time.png" align="absmiddle" />
		<font size="-1">		
		<?
		$date=$row["fecha"].'<br><br>';
		echo $date;
		?>
		</font>
		
		<?
		$comment=$row["comments"].'<br>';
		?>
		
		<font size="+1">
		<?
		echo $comment;
		?>
		</font>	
		
		<?
		echo '<br><br><br>';
		?>
		<hr />
		<?
		}
		include "cerrar.php";
		?>
	</td>
	</tr>
</table>

</body>
</html>

<? //Esta llave cierra else
 } ?>
Ahora el archivo conectar.php
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Conexión con la base de datos</title>
</head>

<body>
<?php
	$conexion= mysql_connect('db1.host.sk','******','*****)
	or die ("No se puede conectar a la base de datos"); 
		
	mysql_select_db(bbddgdtitm)
	or die("No se puede seleccionar la base de datos");
	?>
</body>
</html>
Y el archivo cerrar.php

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Cerrar la conexión con la base de datos</title>
</head>

<body>
<?php
mysql_close($conexion);
?>
</body>
</html>
Bueno pues espero puedan echarme una manita porque ya le he dado miles de vueltas al asunto y nada, en localhost funciona perfectamente, me alojé en www.host.sk, pero al parecer no anda muy bien en velocidad (Gratis al fin!!).