Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/01/2011, 19:22
Avatar de ale_dla
ale_dla
 
Fecha de Ingreso: abril-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 189
Antigüedad: 15 años
Puntos: 3
Reportar mensaje de un foro

Hola a todos!
Estoy intentando hacer que cuando un usuario ve que un tema tiene contenidos implicitos,razismo,etc.. o lo que sea que al usuario no le guste hay un boton para reportar el tema con el id.
Bueno mi codigo php para reportar este:
Código PHP:
<?php
include 'include/php/conexion.php';
//Conexion con la Base de Datos
$link=@dbConnect();
if (!
$link) {
    echo 
"Error conectando a la Base de Datos."
}

if (
$link =="202") {
    echo 
"Error seleccionando la Base de Datos.";
}

$topic_id $_GET['id'];
$report_mensaje "";
$report_mensaje $_POST['report_mensaje'];
$posts_sql "SELECT
                        posts.post_topic,
                        posts.post_content,
                        posts.post_date,
                        posts.post_by,
                        users.id,
                        users.username
                    FROM
                        posts
                    LEFT JOIN
                        users
                    ON
                        posts.post_by = users.id
                    WHERE
                        posts.post_topic = " 
mysql_real_escape_string($_GET['id']);
                        
            
$posts_result mysql_query($posts_sql);
    if (isset(
$_SESSION['id'])) {
        
$sql "INSERT INTO (topic_id,report_by,report_fecha,report_mensaje) VALUES (topic_id='$topic_id'," $_SESSION['id'] . ",report_mensaje='$report_mensaje',now())";
        
$query mysql_query($sql) or die(mysql_error());
        echo 
'Gracias por reportar.<br />';
    }else{
        echo 
'Debes iniciar sesion.';
    }
?>
<form action="" method="post" enctype="multipart/form-data">
<p>Escribe a continuaci&oacute;n el motivo de tu reporte:</p>
<textarea name="report_mensaje" id="report_mensaje"></textarea><br />
<input type="submit" name="submit" value="Enviar">
</form>
Mi tabla es esta:
Código PHP:
CREATE TABLE `topics-report` (
  `
report_idint(11NOT NULL AUTO_INCREMENT,
  `
topic_idint(11NOT NULL,
  `
report_byint(11NOT NULL,
  `
report_fechadatetime NOT NULL,
  `
report_mensajetext NOT NULL,
  `
report_adminint(11NOT NULL,
  
PRIMARY KEY (`report_id`)
ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=
La idea es que en la base de datos se guarda el id del usuario si esta logueado,el mensaje del reporte,el id del tema en topic_id y bueno el report_admin es el administrador que comprueba el tema.
Cuando pruebo para reportar un tema que hice para probar me sale este error:
Cita:
Notice: Undefined index: report_mensaje in C:\wamp\www\web\topics\report.php on line 23
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-report(topic_id,report_by,report_fecha,report_mens aje) VALUES (topic_id='1',1,r' at line 1
Bueno quien pueda ayudarme se los agradezco mucho!
Saludos!