468,720 Members | 1,907 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,720 developers. It's quick & easy.

Practical question on user / comment -system.

Hi there

I've built this user management system, using PHP & mySQL, to manage
users that can comment on a certain site. Users have to be logged in to
comment. Below each comment is (how original) the date of
commenting, and the author.

If the user changes his name in his profile, it changes everywhere. So
what i mean is that the user_id is saved together with the comment.
When the comment is pulled out, the query also gets the user's name.

My question:
What is usually done with users deleted from the member system: this
would lead to a blank name on every appearance of a deleted user's
comment.
Or how do i prevent the blank space, and still show the user's name?

Greetigs Frizzle.

Feb 7 '06 #1
6 1447
On Tue, 07 Feb 2006 01:38:34 -0800, frizzle wrote:
Hi there

I've built this user management system, using PHP & mySQL, to manage
users that can comment on a certain site. Users have to be logged in to
comment. Below each comment is (how original) the date of
commenting, and the author.

If the user changes his name in his profile, it changes everywhere. So
what i mean is that the user_id is saved together with the comment.
When the comment is pulled out, the query also gets the user's name.

My question:
What is usually done with users deleted from the member system: this
would lead to a blank name on every appearance of a deleted user's
comment.
Or how do i prevent the blank space, and still show the user's name?

Greetigs Frizzle.


I never change user details, rather I create a new one with a new ID. That
way, you never have that problem, and the quotes stay attributed to the
person who made them at the time. All you need to do is to add a validity
flag to the user details.

$0.02,

Steve

Feb 7 '06 #2
Do you still want to show the deleted user's comment?

Instead of removing the user from the database, you can use a flag
value. You can have a 'status' column that says active or inactive
(1/0), with a default value of active. When the user is deleted from
member system, set the status to inactive.

This way the comment will still show the username. Or you can choose to
just select/display comments from active users.

However, in other places where you need to know whether a certain user
is active (such as user list), you have to do a "select * from
usertable where status=1" so that you're selecting active users only.

I'm not expert. Hope this helps!

Feb 7 '06 #3
Stanch wrote:
Do you still want to show the deleted user's comment?

Instead of removing the user from the database, you can use a flag
value. You can have a 'status' column that says active or inactive
(1/0), with a default value of active. When the user is deleted from
member system, set the status to inactive.

This way the comment will still show the username. Or you can choose to
just select/display comments from active users.

However, in other places where you need to know whether a certain user
is active (such as user list), you have to do a "select * from
usertable where status=1" so that you're selecting active users only.

I'm not expert. Hope this helps!

@Steve
I don't completely understand what you're saying, but i guess it's the
same as Stanches option ... (?)
What i don't get is "$0.02"

@Stanch, that's what i thought of too, but i wasn't too sure of this
method (i use 'deleted = 0/1') was ok, because a deleted user would
still burden the DB.

Thanks.

Frizzle.

Feb 7 '06 #4
Yeap, but I guess that's a minor tradeoff for things to work properly.

Comments showing properly > Huge db. :P

I myself would like to know if there's another way of doing this
without major change to the db structure.

PS: I think $0.02 means "just my two cents". :D

Feb 7 '06 #5
Stanch wrote:
Yeap, but I guess that's a minor tradeoff for things to work properly.

Comments showing properly > Huge db. :P

I myself would like to know if there's another way of doing this
without major change to the db structure.

PS: I think $0.02 means "just my two cents". :D


I'd like to know as well ... :D

$0.0001

Frizzle.

Feb 7 '06 #6
On 2006-02-07, frizzle <ph********@gmail.com> wrote:
Hi there

I've built this user management system, using PHP & mySQL, to manage
users that can comment on a certain site. Users have to be logged in to
comment. Below each comment is (how original) the date of
commenting, and the author.

If the user changes his name in his profile, it changes everywhere. So
what i mean is that the user_id is saved together with the comment.
When the comment is pulled out, the query also gets the user's name.

My question:
What is usually done with users deleted from the member system: this
would lead to a blank name on every appearance of a deleted user's
comment.
Or how do i prevent the blank space, and still show the user's name?


Don't delete the user, mark them as inactive (or historical) instead.

you could do this by addin a boolean field for this info, to the users
table or by putting a certain value in the password field (etc...)

Bye.
Jasen
Feb 8 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

60 posts views Thread by Fotios | last post: by
2 posts views Thread by Ryan Riddell | last post: by
1 post views Thread by Green | last post: by
2 posts views Thread by mikeingenito | last post: by
1 post views Thread by =?Utf-8?B?aGZkZXY=?= | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.