Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/10/2009, 23:28
lokixxx
 
Fecha de Ingreso: febrero-2009
Mensajes: 20
Antigüedad: 15 años, 2 meses
Puntos: 2
mysql error al insertar un post

Buendo el problema que tengo es el siguiente.

en mi sitio.. cuando quiero postear hay veces donde me salta mysql error. generalmente cuando copio y pego un texto de semi largo de alguna web.

este es una parte del codigo php de agregar.php

Código PHP:
$sql "INSERT INTO posts (elim, id_autor, titulo, contenido, fecha, privado, coments, comentarios, categoria, tags)";
$sql.= "VALUES ('$elim', '$id_autor','$titulo','$mensaje',NOW(),'$privado','$coments','$comentarios','$categoria','$tags')";
$rs mysql_query($sql$con) or die("Error al grabar un mensaje: ".mysql_error);
$ult_id mysql_insert_id($con);
$num $ult_id;

$sql "Update usuarios Set numposts=numposts+'1' where id='$id_autor'";     
mysql_query($sql);

$sql "Update cantidad Set cant=cant+'1' where id='1'";     
mysql_query($sql); 

y esta es la base de datos.


Código:
CREATE TABLE IF NOT EXISTS `posts` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `elim` tinyint(4) NOT NULL DEFAULT '0',
  `id_autor` bigint(20) NOT NULL DEFAULT '0',
  `titulo` varchar(170) NOT NULL DEFAULT '',
  `contenido` text NOT NULL,
  `fecha` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `privado` tinyint(4) NOT NULL DEFAULT '0',
  `coments` tinyint(4) NOT NULL DEFAULT '0',
  `puntos` bigint(20) NOT NULL DEFAULT '0',
  `comentarios` int(11) NOT NULL DEFAULT '0',
  `visitas` bigint(20) NOT NULL DEFAULT '0',
  `tags` text NOT NULL,
  `categoria` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=513 ;

por favor necesito soluconarlo. alguna idea por que puede ser q cuando se postea un texto semi largo tire el error de mysql?

GRACIAS!