sahil Posted March 24, 2017 Share Posted March 24, 2017 I started learning PhP recently and I am trying to create a social network for practice, I have got signup login and user homepage figured out what I can't seem to think about is the logic behind adding friends and blocking people. I tried looking it up and all the answers were a little too complicated for me to understand so if someone could please help me and explain the logic behind this would be a great help. Thank you. Quote Link to comment Share on other sites More sharing options...
Jason Cooper Posted March 27, 2017 Share Posted March 27, 2017 A quick description of what your social network does (or what you want it to do) would be helpful, otherwise we'll just be making broad statements that may or may not be useful, or even correct in the context of your social network. For example, a social network where people join groups and post messages to those groups would require different design to one where users choose to follow others and see everything those others post. Also the underlying technology would be useful to know, e.g. does your PHP use a relational database, a NoSQL database, flat files, etc? Quote Link to comment Share on other sites More sharing options...
sahil Posted March 27, 2017 Author Share Posted March 27, 2017 I have the logic and everything in place but I am having trouble getting the friend request receiver's ID here is the problem that I have described with my database structure and code, on stack overflow. There was a comment but it wasn't really helpful. I hope this link would present my question a little better. Quote Link to comment Share on other sites More sharing options...
Jason Cooper Posted March 27, 2017 Share Posted March 27, 2017 You probably want to add an input element to your form so that the user can can enter a username of the person they want to make the friend request with, then you'll have a username you can use to look up a user_id from your registeredusers table. Also, while Xorifelse's comment on stack overflow could have been worded better, it is definitely worth learning about parameterized queries (better to learn good habits to start with than have to unlearn bad ones later). Quote Link to comment Share on other sites More sharing options...
sahil Posted March 27, 2017 Author Share Posted March 27, 2017 Thank You it worked! and I will take necessary measures for avoiding SQL injections. Thank you once again. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.