stuart7398 Posted March 22, 2008 Share Posted March 22, 2008 Hi. I'm looking to show and hide data in Mysql. My site shows various profiles of people and I want to show their contact details with the last 3 letters or numbers using an '*' When a new member joins the site they will then be shown full contact details without the '*' when i enter new members details into the mysql table, how would i make showing and hiding data possible using php mysql? thanks. Quote Link to comment Share on other sites More sharing options...
stuart7398 Posted March 22, 2008 Author Share Posted March 22, 2008 Hi. I'm looking to show and hide data in Mysql. My site shows various profiles of people and I want to show their contact details with the last 3 letters or numbers using an '*' When a new member joins the site they will then be shown full contact details without the '*' i have a members only area. when i enter new members details into the mysql table, how would i make showing and hiding data to members only possible using php mysql? thanks. Quote Link to comment Share on other sites More sharing options...
mwasif Posted March 23, 2008 Share Posted March 23, 2008 When displaying data, check if the visitor is logged in or not. If the user is logged in, show them the the complete details otherwise use PHP's function to hide the last 3 letters substr($contact_details, 0, -3)."***"; For more details on substr() Quote Link to comment Share on other sites More sharing options...
stuart7398 Posted March 23, 2008 Author Share Posted March 23, 2008 thanks. i have the register and login system. i need to find out how to check login and allow the data to be shown. any ideas? thanks. Quote Link to comment Share on other sites More sharing options...
mwasif Posted March 23, 2008 Share Posted March 23, 2008 Normally such system use sessions to check if user is logged in or not. e.g. Once a user give provide username and password and submit, system verify the details and set session bit that this user has provided a valid username and password. You can check this session bit. Click here to know about sessions. Quote Link to comment Share on other sites More sharing options...
stuart7398 Posted March 23, 2008 Author Share Posted March 23, 2008 thanks. i'm using sessions. what do i use to automatically show the data once logged in. thanks. Quote Link to comment Share on other sites More sharing options...
mwasif Posted March 26, 2008 Share Posted March 26, 2008 You can use session variable which you have set e.g. if($_SESSION["username"]!="") { //show full details } else { //show less details } 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.