Cita:
el problema que tengo es que no puedo hacer ningun comentario en el muro que desarrolle puesto a que me falla esto:$ref = $_POST['ref'];
if(!empty($ref))
{
//comentarios en muros :D
if($ref == 'Muro')
{
global $context, $txt, $settings, $db_prefix, $boardurl, $modSettings;
$iduser = $context['member']['id'];
$context['start'] = (int) $_REQUEST['start'];
$dbresult = db_query("
SELECT
COUNT(*) AS total
FROM smf_profile_comments
", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$total = $row['total'];
mysql_free_result($dbresult);
echo'
<form name="comentador" action="', $scripturl, '?action=comment;sa=add2" method="post" accept-charset="UTF-8" enctype="multipart/form-data">';
if ($context['user']['is_logged']){
echo'<textarea style="box-shadow:inset 4px 4px 4px #CCC;
-moz-box-shadow:inset 4px 4px 4px #CCC;
-webkit-box-shadow:inset 4px 4px 4px #CCC;padding:5px;margin-bottom:4px;border: 1px solid #cccccc;width: 514px; height:30px;" class="markItUpEditor" rows="6" name="comment" id="comment" cols="54" ></textarea>
<input type="hidden" name="memberid" value="' . $context['member']['id'] . '" />
<input type="submit" id="muro-btn" class="Boton BtnBlue" value="Comentar" onclick="comentarmuro(this.form.comment.value,' . $context['user']['id'] . ',' . $context['member']['id'] . ');return false" name="submit" />
<div style="background:#f2f2f2;border:1px solid #ccc;width:425px;height:16px;padding:5px;float:rig ht;text-decoration:none">
<span style="float:right;text-decoration:none">';
smileys();}
echo'</span></div><div style="margin-bottom:5px;"></div>';
echo'</span>
<div id="comentadormuro"></div>';
// Loop though all the comments
$dbresult = db_query("SELECT p.ID_COMMENT, p.ID_MEMBER, p.comment, p.subject, p.date, m.realName, m.avatar, p.COMMENT_MEMBER_ID
FROM smf_profile_comments as p
LEFT JOIN smf_members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
ORDER BY p.ID_COMMENT DESC
LIMIT $context[start],5
", __FILE__, __LINE__);
$comment_count = db_affected_rows();
while ($row = mysql_fetch_assoc($dbresult)){
echo'
<style>
.comnethov{border: 1px solid #CCCCCC;}
.comnethov:hover{border: 1px solid #000000;}</style>';
// COMENTARIOS DEL MURO
echo'
<table class="comnethov" style="padding-right:5px;padding-top:5px;padding-left:5px;padding-bottom:3px;" width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td width="6%" align="center" valign="top">';
if($row['avatar'] == ''){
echo'<a href="/perfil/' . $row['realName'] . '"><img class="ComentFot" src="/Perfil.png" width="40" height="40" ></a>';}
else{
echo'<a href="/perfil/' . $row['realName'] . '"><img class="ComentFot" src="' . $row['avatar'] . '" width="40" heigth="40"></a>';}echo'
</td>
<td valign="top" style="padding-left:5px;">';
echo'<img src="/Pics/Global/PushNegroEdit.png" align="absmiddle">
<b><a href="/perfil/' . $row['realName'] . '">' . $row['realName'] . '</a></b>
| <a href="javascript:mp.enviar_mensaje(\'' . $row['realName'] . '\');" title="',$txt['to_send_mp'],' ', $context['member']['name'], '">Enviar Mensaje</a>
| <a href="/imagenes/' . $row['realName'] . '">Sus fotos</a><hr>
' . parse_bbc($row['comment']) . '<hr>';
echo'<div align="right">';
if (allowedTo('pcomments_edit_any') || (allowedTo('pcomments_edit_own') && $row['ID_MEMBER'] == $ID_MEMBER)) {
echo '<a href="', $scripturl, '?action=comment;sa=edit;id=' . $row['ID_COMMENT'] . '"><b>Editar</b></a>';}
if (allowedTo('pcomments_delete_any') || (allowedTo('pcomments_delete_own') && $row['ID_MEMBER'] == $ID_MEMBER)) {
echo ' <a href="', $scripturl, '?action=comment;sa=delete;id=' . $row['ID_COMMENT'] . '"><b>Eliminar</b></a>';}
echo '</div>';
echo'
</td>
</tr>
</table>';
echo'
<div style="height:5px;"></div>';}
if ($total > 0){
echo'
<b>Paginas:</b>';
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $context['member']['id'] , $_REQUEST['start'], $total, 5);
echo $context['page_index'];
echo '';}
else
if ($context['user']['is_guest']){
echo'<div class="novablue" style="width:500px;"><img src="/Pics/Global/Iconos/Error.png" align="absmiddle" hspace="4">Si quieres dejarle un comentario a ', $context['member']['name'], ' <a href="/registro/">Registrate</a> o <a href="/conectarse/">Conectate</a></div>';}
if($total <= 0) {
echo '<div id="sin_comments_muro" class="yellowBox">', $context['member']['name'], ' no tiene ningún mensaje en su muro.</div>';
}
}
if(!empty($ref))
{
//comentarios en muros :D
if($ref == 'Muro')
{
global $context, $txt, $settings, $db_prefix, $boardurl, $modSettings;
$iduser = $context['member']['id'];
$context['start'] = (int) $_REQUEST['start'];
$dbresult = db_query("
SELECT
COUNT(*) AS total
FROM smf_profile_comments
", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$total = $row['total'];
mysql_free_result($dbresult);
echo'
<form name="comentador" action="', $scripturl, '?action=comment;sa=add2" method="post" accept-charset="UTF-8" enctype="multipart/form-data">';
if ($context['user']['is_logged']){
echo'<textarea style="box-shadow:inset 4px 4px 4px #CCC;
-moz-box-shadow:inset 4px 4px 4px #CCC;
-webkit-box-shadow:inset 4px 4px 4px #CCC;padding:5px;margin-bottom:4px;border: 1px solid #cccccc;width: 514px; height:30px;" class="markItUpEditor" rows="6" name="comment" id="comment" cols="54" ></textarea>
<input type="hidden" name="memberid" value="' . $context['member']['id'] . '" />
<input type="submit" id="muro-btn" class="Boton BtnBlue" value="Comentar" onclick="comentarmuro(this.form.comment.value,' . $context['user']['id'] . ',' . $context['member']['id'] . ');return false" name="submit" />
<div style="background:#f2f2f2;border:1px solid #ccc;width:425px;height:16px;padding:5px;float:rig ht;text-decoration:none">
<span style="float:right;text-decoration:none">';
smileys();}
echo'</span></div><div style="margin-bottom:5px;"></div>';
echo'</span>
<div id="comentadormuro"></div>';
// Loop though all the comments
$dbresult = db_query("SELECT p.ID_COMMENT, p.ID_MEMBER, p.comment, p.subject, p.date, m.realName, m.avatar, p.COMMENT_MEMBER_ID
FROM smf_profile_comments as p
LEFT JOIN smf_members AS m ON (p.ID_MEMBER = m.ID_MEMBER)
ORDER BY p.ID_COMMENT DESC
LIMIT $context[start],5
", __FILE__, __LINE__);
$comment_count = db_affected_rows();
while ($row = mysql_fetch_assoc($dbresult)){
echo'
<style>
.comnethov{border: 1px solid #CCCCCC;}
.comnethov:hover{border: 1px solid #000000;}</style>';
// COMENTARIOS DEL MURO
echo'
<table class="comnethov" style="padding-right:5px;padding-top:5px;padding-left:5px;padding-bottom:3px;" width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td width="6%" align="center" valign="top">';
if($row['avatar'] == ''){
echo'<a href="/perfil/' . $row['realName'] . '"><img class="ComentFot" src="/Perfil.png" width="40" height="40" ></a>';}
else{
echo'<a href="/perfil/' . $row['realName'] . '"><img class="ComentFot" src="' . $row['avatar'] . '" width="40" heigth="40"></a>';}echo'
</td>
<td valign="top" style="padding-left:5px;">';
echo'<img src="/Pics/Global/PushNegroEdit.png" align="absmiddle">
<b><a href="/perfil/' . $row['realName'] . '">' . $row['realName'] . '</a></b>
| <a href="javascript:mp.enviar_mensaje(\'' . $row['realName'] . '\');" title="',$txt['to_send_mp'],' ', $context['member']['name'], '">Enviar Mensaje</a>
| <a href="/imagenes/' . $row['realName'] . '">Sus fotos</a><hr>
' . parse_bbc($row['comment']) . '<hr>';
echo'<div align="right">';
if (allowedTo('pcomments_edit_any') || (allowedTo('pcomments_edit_own') && $row['ID_MEMBER'] == $ID_MEMBER)) {
echo '<a href="', $scripturl, '?action=comment;sa=edit;id=' . $row['ID_COMMENT'] . '"><b>Editar</b></a>';}
if (allowedTo('pcomments_delete_any') || (allowedTo('pcomments_delete_own') && $row['ID_MEMBER'] == $ID_MEMBER)) {
echo ' <a href="', $scripturl, '?action=comment;sa=delete;id=' . $row['ID_COMMENT'] . '"><b>Eliminar</b></a>';}
echo '</div>';
echo'
</td>
</tr>
</table>';
echo'
<div style="height:5px;"></div>';}
if ($total > 0){
echo'
<b>Paginas:</b>';
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $context['member']['id'] , $_REQUEST['start'], $total, 5);
echo $context['page_index'];
echo '';}
else
if ($context['user']['is_guest']){
echo'<div class="novablue" style="width:500px;"><img src="/Pics/Global/Iconos/Error.png" align="absmiddle" hspace="4">Si quieres dejarle un comentario a ', $context['member']['name'], ' <a href="/registro/">Registrate</a> o <a href="/conectarse/">Conectate</a></div>';}
if($total <= 0) {
echo '<div id="sin_comments_muro" class="yellowBox">', $context['member']['name'], ' no tiene ningún mensaje en su muro.</div>';
}
}
Cita:
en el codigo anterior hago llamado a:<input type="hidden" name="memberid" value="' . $context['member']['id'] . '" />
Cita:
este a su vez en:' . $context['member']['id'] . '
$iduser = $context['member']['id'];
y luego hago la query:
Cita:
pero si coloco esto en la query$dbresult = db_query("
SELECT
COUNT(*) AS total
FROM smf_profile_comments
", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$total = $row['total'];
mysql_free_result($dbresult);
SELECT
COUNT(*) AS total
FROM smf_profile_comments
", __FILE__, __LINE__);
$row = mysql_fetch_assoc($dbresult);
$total = $row['total'];
mysql_free_result($dbresult);
WHERE COMMENT_MEMBER_ID = " . $context['member']['id'] . "
me da el siguiente error
Cita:
Gracias de antemano 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 '' at line 1
Archivo: /home/novazcom/public_html/muros.php
Línea: 26
Archivo: /home/novazcom/public_html/muros.php
Línea: 26