Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

archiebango's avatar

How do I add If-Else and Query to database?

Hi, I am planning to build a simple website that has 3 types of account, Admin, Seller, and Buyer.

  • I created a different row like, 'Firstname', 'Lastname' ,'Email', and 'Role'
  • Under 'Role' it has 3 types, admin, seller, and buyer
  • How can I code this in HomeController? My logic is to query the database: If the user have 'Seller' in Role Row, then he will be redirected to Seller Page only and cant access other pages.
0 likes
3 replies

Please or to participate in this conversation.