Jump to content

erdem

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by erdem

  1. what do you mean enough information? I gave you my entire codes:)) I gave you the database structure. what else would you like to know?
  2. al of these shows me mysql codding I'm asking that how do I display with php? for example -Comment 1 -Replay 1 for Comment 1 -Replay 2 for Comment 1 -Replay 1 for Replay 2 -Comment 2 and so on.....
  3. Hi everyone, I hope I can explain. Please help me for this. any idea or help can safe my life. thanks. I have 3 mysql table (users and categories the others. total is 5). contents, comments, votes. so I pull the content and then comments of the content and then votes for the comments. What I would like to do is answering system for the comments. similar to reddit or youtube comments. my comment table is this CommentsID - ContentsID - UserID - Comment - Time - Parent - WriteIP - Active -TotalVotes - VoteSum Parent come from CommentsID So, this is Hierarchical Data. But i cannot figure out how can I display this. this is my query $Where = array( "ct.ContentsID = '" . $Contents['ContentsID'] . "'" ); if ( $_SESSION['UserID'] == 0 ) $Where[] = "ct.Active = '1'"; else if ( $_SESSION['Level'] < 3 ) $Where[] = "(ct.Active = '1' OR ct.UserID = '" . $_SESSION['UserID'] . "')"; else { $THEME->loadJS( 'Ajax.js' ); $THEME->loadJS( 'Moderate.js' ); } $sql = mysql_query( "SELECT ct.*, ut.*, vt.UserID UserVote FROM comments ct INNER JOIN users ut ON ut.UserID = ct.UserID LEFT JOIN voters vt ON ( vt.CommentsID = ct.CommentsID AND vt.UserID = '" . $_SESSION['UserID'] . "' ) LEFT JOIN comments cp ON ( ct.Parent = cp.CommentsID ) WHERE " . implode( ' AND ', $Where ) . " ORDER BY Time DESC" ); and this is how I display everything if ( !$sql ) echo mysql_error(); if ( mysql_num_rows( $sql ) ) { $Contents = array(); $Count = 0; $LoadVoteJS = false; while ( $ROW = mysql_fetch_array( $sql ) ) { $Status = ''; $WriteTime = $ROW['Time'] > 0 ? date( 'd.m.Y H:i:s', $ROW['Time'] ) : ''; $Content = preg_replace( '/tag:&#8220;([^&]+)&#822[01];/ie', "'<a href=\"/tag/'.tagPointer('\\1').'.html\">\\1</a>'", $ROW['Comment'] ); $Vote = ""; if ( $ROW['Active'] == '0' ) $Status = $_SESSION['Level'] >= 3 ? '<a onClick="MsgOnayla(\'' . $ROW['CommentID'] . '\',this);" style="cursor:pointer">Onayla!</a> <a onClick="MsgSil(\'' . $ROW['CommentID'] . '\',this);" style="cursor:pointer">Sil!</a>' : 'Onay Bekliyor!'; else if ( $_SESSION['Level'] >= 1 ) { if ( is_null( $ROW['UserVote'] ) AND $ROW['UserID'] != $_SESSION['UserID'] ) { $LoadVoteJS = true; $Status = '<span id="voteContent-' . $ROW['CommentID'] . '">[ <a onClick="MsgOyla(\'' . $ROW['CommentID'] . '\',\'1\');" style="cursor:pointer">?yi!</a> | <a onClick="MsgOyla(\'' . $ROW['ContentID'] . '\',\'0\');" style="cursor:pointer">Kötü!</a> ]</span> '; } else if ( $ROW['TotalVotes'] > 0 ) $Vote = "%" . intval( 100 * ( $ROW['VoteSum'] / $ROW['TotalVotes'] ) ); } if ($ROW['Active'] == '1') $Oparation = $_SESSION['Level'] >= 3 ? '<a onClick="MsgSil(\'' . $ROW['CommentID'] . '\',this);" style="cursor:pointer"><img src="/Themes/Standart/Image/delete_content.gif"></a>' : ''; if ($_SESSION['UserID'] != $ROW['UserID']) $Message = $_SESSION['Level'] >= 1 ? '<a href="/Message/?senduser='.$ROW['UserID'].'">Mesaj</a>' : ''; $Name = '<a href="/User/profile.php?id='.$ROW['UserID'].'">'.$ROW['Username'].'</a>'; $Contents[] = t_ContentBox( $Content, $Name, $WriteTime, $Status, $Vote, $Message, $Oparation ); if ( $Count++ == 0 AND $_SESSION['Level'] < 3 ) $Contents[] = t_ContentBanner(); } if ( $LoadVoteJS ) { $THEME->loadJS( 'Ajax.js' ); $THEME->loadJS( 'Vote.js' ); } $_PAGE .= t_commentinfo(mysql_num_rows($sql)); $_PAGE .= t_Contents( implode( t_ContentSeperator(), $Contents ), $CommentForm, $Title ); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.