Ayuda en cometnarios se isertan los comentarios en todos los post
hola amigos tengo un problema con el sistema de comentarios en ver_post.php cuando el user comenta en un x comentario aparencen en todos los post capas que sea el consulta de SQL les paso mi codigo de sql
<?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_sacar_comentarios = "SELECT * FROM r_comentarios WHERE id_post=2 AND estado >1 ORDER BY id_coment DESC"; $sacar_comentarios = mysql_query($query_sacar_comentarios, $conexion) or die(mysql_error()); $row_sacar_comentarios = mysql_fetch_assoc($sacar_comentarios); $totalRows_sacar_comentarios = mysql_num_rows($sacar_comentarios); ?>
0
Puntos
Puntos
1183
Visitas
Visitas
2
Resp
Resp
Por fc2014 hace 121 meses
Experto
Respuesta #1
Hola fc2014, sería bueno que nos mostraras el código donde insertas el comentario y el código donde muestras los comentarios de ver_post.php
Aunque por lo que veo aquí
Aunque por lo que veo aquí
$query_sacar_comentarios = "SELECT * FROM r_comentarios WHERE id_post=2 AND estado >1 ORDER BY id_coment DESC";estás pidiendo los comentarios del id_post 2, que en realidad debería ser mediante un $_GET. Si me permites ver el código creo que puedo ayudarte mejor :D
Respuesta #2
bueno jose en si era un error tan vovo era poner $iddelpost por que yo puse WHERE id_post=2 y tenia que ser WHERE $iddelpost AND estado=1 ORDER BY id_coment DESC
igual mente Gracias
igual mente Gracias
0
Puntos
Puntos
Por fc2014 hace 121 meses
Experto