anshulmahipal Posted May 14, 2015 Share Posted May 14, 2015 Hello guys,. I almost complete my website including member area but now problem comes....... I need a help that every user can access their content and content is posted by admin via c pannel. for example suppose I am a admin and a user called x create his account now he is able to access the page called user.php and now admin post a content on x user page which accessible by x user only after login and other user not even saw the same content even after login so help me on this please . Please provide me source code too. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 14, 2015 Share Posted May 14, 2015 We aren't here to write your code for you. If you want content that only certain users see then you need to design your database to support that. If it is only for 1 user then you can put a user ID in the content table in the database. If content can be seen by multiple users then you need a separate table to hold user ID/content ID pairs to say which users can see which content. When a user pulls up that page then you can ask the database for the content for that user ID. 1 Link to comment Share on other sites More sharing options...
anshulmahipal Posted May 15, 2015 Author Share Posted May 15, 2015 Sir, thanks to give me idea about. Will you please a little code about it Link to comment Share on other sites More sharing options...
justsomeguy Posted May 15, 2015 Share Posted May 15, 2015 Show the code that you're working with and what problems you're having and we can help you with those. I was talking about database design above, not code. Link to comment Share on other sites More sharing options...
davej Posted May 15, 2015 Share Posted May 15, 2015 Think about what you are already doing. The user has logged in so now you have some session variables that tell your database queries what messages or content to load. A table for public messages has a "from" column but a table containing private messages is going to also have a "to" column. So then what does it matter if the messages are from the admin or from some other user? What matters is that the content is intended for a particular user. 1 Link to comment Share on other sites More sharing options...
anshulmahipal Posted May 16, 2015 Author Share Posted May 16, 2015 (edited) sir sorry but i dont about sql quires so kindly explain me briefly. m create a user page where i can the user name. but i dont understand how i post particular content for particular user page Edited May 16, 2015 by anshulmahipal Link to comment Share on other sites More sharing options...
davej Posted May 16, 2015 Share Posted May 16, 2015 Your question is too vague. I don't know what your user content is. I presumed you were loading content from a database. You say the users log-in, so you establish sessions, right? You use session variables to decide what content to show, right? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now