-
Best way to implement a "comments system" database?
Thanks to everyone for replying. I've actually studied normalization already so I was planning on doing that anyway. It would seem that when you do normalize it to 3NF, you're going to get (as mentioned above) something like this: - USERS (user ID, name, ...) - ARTICLES (article ID, title, ...) - COMMENTS (comment ID, article ID*, user ID*, comment txt...) Where * means foreign key That would definitely work, however as I mentioned in my original (confusing) post, would using this method not be extremely inefficient because the COMMENTS table would have to be completely analysed and filtered every time an article is displayed? For example, if I have 1000 comments in my COMMENTS table, and there's 10 comments with an article ID of "5", then the database is going to have to sift through the other 9990 comments before finding the 10 comments with an article ID "5". Surely very inefficient? Storing the comments in a seperate COMMENTS database would surely be better because then you'd just have one table for each article (e.g. 100 articles = 100 tables) and when displaying each article's comments, you just "SELECT * FROM comments.article5comments" and it lists them all! Any thoughts? Thanks
-
Best way to implement a "comments system" database?
Hi all! For a school project, I've to implement a fairly simple PHP and mySQL comments system. Basically, the user should be able to add their own comments at the bottom of every page on my site. Doing this seems, theoretically, fairly simple, however I was wondering what you all thought the best WAY to implement this would be? Think of, maybe, a news website - 100 articles with 10 comments on each article, and a good number of different users. So I'm gonna need at least 3 sections to my database system... a place to store article details, a place to store user details, and a place to store comment details. Whether these will be seperate tables or whole seperate databases, I don't know, but I'm focusing on the comments side of things for now. I could even use one huge "comments" table, where each row just has "comment ID", "article ID", "username" "comment_txt" ... and so on, but surely if the site had 500+ comments spanned over 100 articles then this method would get very slow? I thought of using a seperate "comments" database by itself, and creating a new table for each article which would store a single set of comments on their own (i.e. one table per article). But then I won't be able to create relationships between my "comments" database and my "main" database, right? Sorry if this is confusing... basically, any thoughts on the simplest yet (if possible) efficient way of storing a comments system? Thank you all, have a great day Rex
-
Image corruption on Apache server - file size limits?!
What's interesting is, I set up the server again on a virtual machine (same OS, etc.) and the images *appear* to work fine. a PNG does "contain errors" and won't display but large JPEGs will, which is a start! Must be some kind of fluke installation issue or something particular in a user's environment.
-
Image corruption on Apache server - file size limits?!
Apache is installed by itself not with WAMP . Just found these (unanswered) posts on other forums which detail my problem some more:
-
Image corruption on Apache server - file size limits?!
Good day, all! I've just set up Apache 2 on an XP machine, and when I try to view an image through the local server, it's badly corrupted. Either it won't display at all or half of it is visible perfectly, and the rest is totally grey. I have deduced that there is a certain filesize limit that Apache works upon with these images. The first image I tried was 100kB, and the latter half of it was grey. Then I increased JPEG compression and made it 80k. Only 1/3 of it was grey. I reduced the size down to 40k and - you guessed it - the image displayed perfectly. I've tried this with JPG and PNG files and have searched Apache's config files to see if there's some kind of "transfer/stream" limit... but haven't found anything. Can someone please shed any light on this? It's driving me insane. Many thanks. Rex
-
Dynamic CSS with multiple columns? (argh!)
Thank you VERY much for the help, Rob! I'll begin experimenting with that code right now And thanks to you too, ooyes, I'll have a look and see if I can find more cool Javascript tricks on DynamicDrive.
-
Dynamic CSS with multiple columns? (argh!)
Hi all I have struggled trying to make this work over the last day or so and have totally given up. Basically, I want a site with two columns, and I'd like either column to be able to "elongate" or increase in height whilst the other column remains in position. Meanwhile, a set footer would move down the page as either column increased. A brilliant example of what I'm on about is available here: http://www.sky.com/ -- If you go there, and just hit the "Log In" button on the right, you'll see the login box appears out of nowhere and the right hand column increases in height. Meanwhile, the page footer remains stable and moves down the page perfectly. First of all, I would ask anyone if they have any tutorials/links on how Sky made the login box "appear" so attractively. Secondly, I'd ask the same about just how they made the columns and the footer behave so well. I'm sorry my questions are not more specific but this is a pretty nice looking feature! Thanks to everyone who helps! Rex