Note that there are some explanatory texts on larger screens.

plurals
  1. POWallposts and comments
    primarykey
    data
    text
    <p>I've made one table for all comments on a social network site: comment</p> <p>Also, I've one table for all comments assigned to one comment: comment_assign</p> <p>So, I built a function comment() to implent it easily in each section type (images, userpage, groups, etc). In case of $_GET['s']==user, I want to have wallposts as well as comments on these wallposts. All stored in 'comment'.</p> <p>I've got this scheme to display this: 1. sql query to get the comments 2. html output 3. another sql query inside this html output to get specified assigned comments of a comment (wallpost in this case)</p> <p>Now the problem is that my first query displays all comments. Also comments that are supposed to be subcomments. So my question is, if there's any way to specify in this first query, when I get all my comments, to say: Look in comment_assign if this comment_id is available. And if it is, don't display this comment, because it's a subcomment (that I'll display in mentioned step 3).</p> <p>Maybe this whole structure may be changed? I would appreciate any suggestions. Even hard to realized ones, but which would be the most efficient.</p> <hr> <p>Table structure:</p> <p><strong>comment</strong></p> <p>id, uid, nid, site, text, date</p> <p><strong>comment_assign</strong> </p> <p>comment_id, assign_id</p> <hr> <p>First SQL Query example, which doesnt work to avoid displaying all the comments (also assigned ones). See the last line:</p> <pre><code>SELECT * FROM `comments` AS c LEFT JOIN `comment_assign` AS ca ON ca.`comment_id` = c.`id` LEFT JOIN `users` AS u ON c.`uid` = u.`id` WHERE c.`nid`='".$nid."' AND c.`site`='".$_GET['s']."' AND ca.`comment_id` != c.`id` </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload