Ver Mensaje Individual
  #14 (permalink)  
Antiguo 06/11/2010, 11:36
den_22
 
Fecha de Ingreso: enero-2010
Mensajes: 198
Antigüedad: 14 años, 3 meses
Puntos: 1
Respuesta: Problema con esta consulta

Si, disculpá, acá lo pongo este es todo el archivo:
Código PHP:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <?php
  5. error_reporting(E_ALL ^ E_NOTICE);
  6. session_name('bpLogin');
  7. include "connect.php";
  8.  
  9.     if($_SESSION['usuario'] == '' && !isset($_SESSION['usuario'])) {
  10.         header("location:index.php");
  11.     }
  12. $id=$_SESSION["id"];
  13. $usuario=$_SESSION["usuario"];
  14.  
  15. $sql = "SELECT * FROM question WHERE questionid = " .$_REQUEST["idPreg"]." ";  
  16.     $result = mysql_query($sql) or die ("No se pudo ejecutar la consulta");
  17.    
  18.      
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.    
  26. while ($rowCom=mysql_fetch_assoc($result)){
  27.  
  28. $questionid=$rowCom["questionid"];
  29.  
  30.  
  31. ?>
  32. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  33. <title>responder pregunta</title>
  34. <link href="index.css"  rel="stylesheet" type="text/css" />
  35. <link href="responderpregunta.css" rel="stylesheet" type="text/css" />
  36. <link rel="stylesheet" type="text/css" media="screen" href="css/stylesheet.css" />
  37. <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
  38. <script type="text/javascript" src="js/rating.js"></script>
  39. <link rel="stylesheet" type="text/css" href="rating.css" />
  40.  
  41. <style type="text/css">
  42. <!--
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. -->
  50. </style>
  51. <SCRIPT>
  52. function contar(form,name) {
  53.   n = document.forms[form][name].value.length;
  54.   t = 700;
  55.   if (n > t) {
  56.     document.forms[form][name].value = document.forms[form][name].value.substring(0, t);
  57.   }
  58.   else {
  59.     document.forms[form]['result'].value = t-n;
  60.   }
  61. }
  62. </script>
  63. </head>
  64. <script type="text/JavaScript">
  65. <!--
  66. function MM_swapImgRestore() { //v3.0
  67.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  68. }
  69.  
  70. function MM_preloadImages() { //v3.0
  71.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  72.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  73.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  74. }
  75.  
  76. function MM_findObj(n, d) { //v4.01
  77.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  78.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  79.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  80.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  81.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  82. }
  83.  
  84. function MM_swapImage() { //v3.0
  85.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  86.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  87. }
  88.  
  89.  
  90. //-->
  91. </script>
  92.  
  93. <body>
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. <div id="panel_usuario"><div class="breadcrumb">
  110.   <span class="left"></span>
  111.     <ul>
  112.  
  113.       <li><a href="index.php" class="active">Inicio</a></li>
  114.       <li><a href="panel.php?user=<?php echo $_SESSION[id]; ?>" >Volver a "Mi Cuenta"</a></li>
  115.      
  116. </ul>
  117.   <span class="right"></span></div></div>
  118.  
  119.  
  120. <body onload="MM_preloadImages('image/logosus.png')">
  121. <div id="logo"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','images/logosus.png',1)"><img src="images/logo.png" name="Image1" border="0" id="Image1" /></a></div>
  122. <div id="cuadro_panel_1"></div>
  123. <div id="res_preg"></div>
  124. <div id="cont_pregunta">
  125. <form action="respuestapregunta.php?idPreg=<?php echo $_REQUEST['idPreg']; ?>" method="post" name="cont_preg">
  126. <div id="titulo_resp"></div>
  127. <div id="cont_pregunta_resp"><?php echo $rowCom["question_text"];?></div>
  128.  
  129. <div id="cont_respond"><textarea name="txtans" cols="50" rows="9,5"  onkeydown="contar('cont_preg','txtans')" onKeyUp="contar('cont_preg','txtans')" id="txtans" style="background-image:url(images/turesp.png); border:none; background-repeat: repeat; font-family:Arial, Helvetica, sans-serif;"></textarea></div>
  130. <div id="cont_caract">
  131.   <INPUT name=result value=700 size="3" readonly="true"></div>
  132.   <div id="id_cont" ><input type="hidden" name="idPreg" id="idPreg" value="<?php echo $_REQUEST['idPreg'];?>"  /></div>
  133.  
  134. <div id="responder_cont"><input type="submit"  name="respreg" value="Responder" class="bt_login" style="background:url(images/responder.png); width:153px; height:35px; font-weight:bold; font-family:bubbleboddy, 'bubbleboddy light';font-size:18px; border:none; color:#FFFFFF" /></div>
  135.  
  136. </form>
  137. </div>
  138. <?php } ?>
  139. <?php $sql = "SELECT answer_text,questionid,userid  FROM answer WHERE questionid=" .$_REQUEST["idPreg"]."";  
  140.     $res = mysql_query($sql) or die ("No se pudo ejecutar la consulta");
  141. ?>
  142.  
  143. <div id="mostrarresp">
  144.  
  145. <?php while ($rs0=mysql_fetch_assoc($res)){ $nameid=$rs0["userid"];  
  146. $rs2=mysql_query("SELECT * FROM answer JOIN usuarios ON answer.userid = usuarios.id WHERE answer.questionid=".$_REQUEST["idPreg"]." and answer.userid=$nameid ");  
  147. $rs1=mysql_num_rows($rs2);
  148.  
  149.  
  150. ?>
  151. <div class="respuestas"><hr /><?php  echo nl2br( $rs0["answer_text"]); ?></div>
  152. <div class="de">Respondido por [<?php $to_name=mysql_fetch_array(mysql_query("select * from usuarios where id=$nameid")); echo $to_name["usuario"]; echo $to_name["id"]; ?>] <p style="color: #000000; font-family:Verdana; font-size:12px;">Votar respuesta<?php while ($rs1=mysql_fetch_array($rs2)) { ?><ul class="rating">
  153.     <li><a href="votar.php?valor=1&idanswer=<?php echo $rs1["answerid"];?>" title="1 Punto">1</a></li>
  154.  
  155.     <li><a href="votar.php?valor=2&idanswer=<?php echo $rs1["answerid"];?>" title="2 Puntos">2</a></li>
  156.     <li><a href="votar.php?valor=3&idanswer=<?php echo $rs1["answerid"];?>" title="3 Puntos">3</a></li>
  157.     <li><a href="votar.php?valor=4&idanswer=<?php echo $rs1["answerid"];?>"  title="4 Puntos">4</a></li>
  158.     <li><a href="votar.php?valor=5&idanswer=<?php echo $rs1["answerid"]; ?>" title="5 Puntos">5</a></li>
  159. </ul>
  160. <?php } ?>
  161. </div>
  162.  
  163. <?php
  164. echo '<br/>';
  165. }
  166.  ?>
  167.  
  168.  </div>
  169.  
  170.  
  171.  
  172.  
  173. </body>
  174. </html>


Lo que se me repite, son los <li> de votar. me aparecen dos veces debajo de la respuesta