Accessing current user and info from custom database

I have a custom database that contains my users information such as username, password etc. When users go to their profile page (a dynamic page) I need code that can access the current page user’s information and then use that value to trigger certain things using if statements. How do I get the current page users info from my database?

You will need to search your database. See this example:

Search a Database

Add search functionality to your site by adding input elements to the page and then adding code to enable a search.

See the Wix Code docs for much more information, and see more examples: