Hi, I'm using PHP, I am trying to develop:
1. a login page in HTML, once user enter the correct username and password, this will be directed to the User page.
2. In User page, there will be some text fields of the user (eg. name and address), all these suppose to retrieve from SQL Server. In here, if the username is found in the database, his/her data will be displayed in the textboxes ( eg. name and address), if not, the textboxes remain empty. User can choose to edit or enter new data into the textboxes and submit back to the datadase.
3. Once updated, user can click "save and logout" to save the data and logout.
I've done the login part, but only in (2), I can't retrieve the user's data from databases based on User.Identity.Name. Any idea how to retrieve data based on user's username?
Thanks.
Recommended Answers
Jump to PostDo you have any code started? If you have the login process done then in my opinion you've done the hardest part. Just write a simple SQL query to Select data from your table Where the username submitted is equal to the username column in your table. If it is …
Jump to PostI'd just add, that you only need to keep the user id in a session, unless you want to have soething like logout username. Searching on the primary key should be quicker than the actual username itself.
Jump to PostWell, use mysqli or PDO for your DB retrieval/manipulation. As far as it goes, it's not actually that bad a script. Where did you get it?
Missing UDFs:
filter()
GenKey()
All 10 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.