Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

allow users to post on other users profile pages

Posted on 2011-03-04
2
Medium Priority
?
205 Views
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
0
Comment
Question by:helpchrisplz
2 Comments
 
LVL 8

Accepted Solution

by:
rationalboss earned 2000 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:
posts
------
postid INT PRIMARY KEY AUTO_INCREMENT NOT NULL
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 :)
0
 
LVL 1

Author Closing Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

972 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