The only way to do it (I can think of) is to get all the blog entries for
that day, and then go and get the comments for each one.

Get blogs
For each blog
   Output blog
   Get comments
   For each comment
      Output comment
   Next comment
Next blog


Ian

On 12/12/05, rkw1956 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> What I'm trying to achieve I would have thought would have been very
> simple, but I must be stupid, LOL!
>
> I have two tables - blogs (for blog entries) and comments (for
> comments on the blog entries).
>
> The blogger writes an entry and visitors leave comments for a
> particlular blog entry. The comment entry form will appear under
> each blog entry, and after the associated comments if there are any.
>
> I want to display on the web page all the blog entries for a
> particular day followed directly underneath each blog entry by any
> comments, or none at all if no comments have been made.
>
> I have a number of fields in each table:
>
> =====
> blogs
> =====
>
> bID (primary key)
> timeAdded
> title
> entry
>
> ========
> comments
> ========
>
> cID (primary key)
> bID (foreign key)
> timeAdded
> name
> comment
>
> As I understand it, this is a one to many relationship (one blog
> entry to many comments).
>
> What I can't get my head round is how to write the mysql query so
> that a particular blog entry is displayed with its associated
> comments displayed directly underneath, followed by the next blog
> entry and associated comments.
>
> As an aside (I think I can work out how to do it) the blog entries
> for a particular day will be listed last entry first and the
> associated comments listed first comment first.
>
> TIA for any help.
>
> Richard
>
>
>
>
>
> Community email addresses:
>   Post message: [email protected]
>   Subscribe:    [EMAIL PROTECTED]
>   Unsubscribe:  [EMAIL PROTECTED]
>   List owner:   [EMAIL PROTECTED]
>
> Shortcut URL to this page:
>   http://groups.yahoo.com/group/php-list
>
>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    -  Visit your group "php-list<http://groups.yahoo.com/group/php-list>"
>    on the web.
>
>    -  To unsubscribe from this group, send an email to:
>     [EMAIL PROTECTED]<[EMAIL PROTECTED]>
>
>    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>
>  ------------------------------
>


[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to