This has always confused me to no end and now that I really need a JOIN I need to get this.
I am working with a small blogging section of my site here. In one table I have "blogs" and another table I have "comments".
My comments table stores the id of "blogs" as well as the comment, id of the commentor and idea of the blog originator.
I have the id blog stored and included it in my link
I would like to get all the data from both tables related to this blog id which is stored in both tables and loop all data for comment display for that blog id.
I have this now but it doesn't seem to be handling my needs:
$blogView = $_GET['blogView']; //This stores the id of the blog being shown //Now I want to get all comments and other pertinent data to display comments, commenters and date of comment $sqlC = "SELECT table_comments.*, table_blogs.* FROM table_comments INNER JOIN table_blogs ON table_comments.id_blog, table_blogs.id_blog = '$blogView'"; $resultC = mysql_query($sqlC) or die(mysql_error()); $rowC = mysql_fetch_array($resultC);
I've tried reading MySQL's website on JOINS but I am not getting it.
Any help is greatly appreciated...