allow users to post on other users profile pages

Posted on 2011-03-04
Last Modified: 2012-05-11
allow users to post on other users profile pages.

ok so am learning php :)

i can register a user get him to log in and display a profile page with info about them that they can edit.

now i am moving on to allow other registered users who also have there own profiles to be able to post on there friends profiles (like face book) but i cant get my head around the database relationships to allow posts to only appear on the profile page that it was posted on.
can any one push me in a direction to what to look at that can help me understand how to do this
Question by:helpchrisplz

Accepted Solution

rationalboss earned 500 total points
ID: 35035245
Since you mentioned that you can already register/authenticate users, you need to utilize this information to handle the posts.

For example, create the following table:
post_date DATETIME
post_text TEXT
post_to INT
post_by INT

post_to and post_by are user IDs of your users. This would be the primary key you used in your users table.

Whenever there is a new post, you insert the data to 'posts'
INSERT INTO posts (postid,post_date,post_text,post_to,post_by) VALUES (NULL,NOW(),'This is an example post!',1,2); // this means userID=2 posted to userID=1

Hope this made sense :)

Author Closing Comment

ID: 35125761
this is great thx i have been AFK for a bit and only getting this sorted now but thx for this help

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now