Sponsored by NuSphere - PHP Software for PHP Application Developers - On Sale This Week for $100



Go Back   PHP-Editors > Linux, Apache, MySQL > MySQL Help

MySQL Help Post any question relating to MySQL here and hopefully someone can help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 2006-06-04, 09:33 PM
Junior Member
 
Join Date: Jun 2006
Posts: 3
alco19357 is on a distinguished road
Default inserting MULTIPLE data in mysql

Hey. I need a comments system for my members of my site. It looks like myspaec, and it logs into a database (MySQL) via localhost. I want it to store multiple data about the user. So that other users can leave feedback. It's kinda of like a forum, I believe. So say user X writes about user A. Then say user Y writes about user A. I want it to write on the view profile page, of user A: the comments left by user X, and user Y.

How do I store this in a mysql base. I have a database assigned to the whole project. Table 1 = admin, Table 2= users. In users table i have all the user data, like pics, name, pass, email, about me, and etc. Im not sure if I should also add the comments in the user table (table 2). Please help.

THanks, alex
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 2006-06-04, 11:21 PM
Junior Member
 
Join Date: Jan 2006
Posts: 24
crebilis
Default

Hi,

you could make a second table called comments. As the name suggests, you store all the comments inthere, like you would do for a forum thread. The columns could be like: id, poster (user Y or X in your example), user (user A), comment, date (if you want to store the date on which teh comment was added).

I hope this helped,

Crebilis
Reply With Quote
  #3 (permalink)  
Old 2006-06-05, 02:35 AM
Junior Member
 
Join Date: Jun 2006
Posts: 3
alco19357 is on a distinguished road
Default But how?

I dont get it. If I just used the same thing, wouldnt that erase the old data, and over write when someone new replies?
Reply With Quote
  #4 (permalink)  
Old 2006-06-05, 03:03 AM
Xnuiem's Avatar
Senior Member
 
Join Date: May 2004
Location: DFW, Texas
Posts: 1,104
Xnuiem will become famous soon enough
Send a message via Yahoo to Xnuiem
Default

Just insert new records each time.
__________________
I rarely give code examples.
No, I have never used IIS or Windows of any kind as a web server. Get a real OS!
Please don't PM me, I won't respond.
Reply With Quote
  #5 (permalink)  
Old 2006-06-05, 09:25 AM
Junior Member
 
Join Date: Jan 2006
Posts: 24
crebilis
Default

yup, each time a new record in the databse.

on the profile page of user A, you just take out all record where the user is A and write them down through a while loop.

It's just like you would do a forum thread, so if you need examples, there are enough basic forum scripts on the internet, so take a look at those codes.

and don't forget:

www.mysql.com
www.php.net
www.google.com

are your friends .

Crebilis
Reply With Quote
Must read Review for Serious PHP Developers


NuSphere PhpED 5.0 : The Staff of php-editors.com recently spent a few days working with NuSphere PhpED 5.0 (a popular PHP IDE) and NuCoder 1.4 (a PHP Encoding Utility), read up on all the details.

Sponsored Links
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:19 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.