RE: [PHP] MYSQL TABLES (One To Many Relationship)
| From: | abdulazeez alugo | Date: | Mon, 23 Mar 2009 09:34:45 +0000 |
| Subject: | RE: [PHP] MYSQL TABLES (One To Many Relationship) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290558@lists.php.net to get a copy of this message | ||
Thanks Tedd,
You're such an angel. I've tried it your way and it works perfectly well.
(maybe I'll send you a return ticket to Nigeria when I organize the PHP conference).
Hey Dan, help me amplify my thanks to Tedd.
Alugo Abdulazeez
www.frangeovic.com
> Date: Sun, 22 Mar 2009 14:38:01 -0400
> To: defatigue@hotmail.com; php-general@lists.php.net
> From: tedd.sperling@gmail.com
> Subject: Re: [PHP] MYSQL TABLES (One To Many Relationship)
>
> At 5:04 PM +0100 3/22/09, abdulazeez alugo wrote:
> >Hi guys,
> >
> > I need help on something I'm working on and its really eating me up
> >so I'll appreciate any help I can get on it.
> >
> >I'm writing code for a site that posts a topic for discussion and
> >accepts comments (Just like a parliament).
> >
> >There are different discussions for every day and the comments
> >should be displayed along with the corresponding topics per day.
>
> Hi Alugo:
>
> I wrote a similar thing for my site, see here: http://sperling.comØÊ3ò
> Á»P·>¬–L”
>
> As you can see, on most pages people can add comment.
>
> Considering such, the most important part I found was designing the
> tables for the database. I used two tables, which follow showing
> fields:
>
> COMMENTS table
> Fields
> id <-- auto-increment id for comments
> post_time <-- time of this post
> poster_id <-- the id from the POSTERS table
> page <-- the page the poster commented on
> comment <-- the actual comment made by the poster
> notify_me <-- an option for the poster to select IF they want to be
> notified of additional posts
> approved <-- option for me to use if I want the post to be displayed
>
> POSTERS table
> Fields
> id <-- auto-increment id for posters
> time <-- time of first post (i.e., registration)
> poster <-- name of poster
> email <-- email of poster (after confirmation of email address)
> ip <-- ip of poster (taken from post)
> web_site <-- web site of poster (if given)
> banned <-- option for me to use if I want to ban this poster
>
> So as you can see, this is one table for posters and each poster can
> post many comments (i.e., a "one to many" relationship).
>
> Each time a post is made, the posting method checks the database for
> poster approval. Either the poster is approved, banned, or yet to be
> registered -- each path is followed accordingly.
>
> Note as each page is loaded the comments are pulled from the database
> and shown, or not, depending upon if the poster is approved OR if I
> have overridden the post. This allows me to ban the post, but not the
> poster. But in most cases, if the poster post something that I don't
> like, then the poster is also banned.
>
> HTH's
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com
> http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx