PHP connections to mysql database explained

Discussion in 'Forum Discussion' started by hookshy, Feb 13, 2018.

  1. hookshy

    hookshy Well-Known Member Licensed User

    I use in one of my projects a php file to connect to my sqldatabase , all users connect to the database from this phpfile with one mysql user.

    Should I create multiple php files to separate tasks within the app ?
    The php connects with relation to one user defined in mysql database ,is there enough to use one user for all connections or I should create more users for each php file ?


    Thank you
     
  2. sorex

    sorex Expert Licensed User

    It depends on the situation.

    sometimes I use a read only user for front-end tasks and a modify account for the backend to edit content.

    if you want to keep track of for example download counts and display it near the download link you need modify rights aswell to update the download count (unless you do it in a file).
    so in most cases you still need r/w even for the front end. So you could add a r/w account to the download code page only or apply it to the general site db code include.
     
  3. hookshy

    hookshy Well-Known Member Licensed User

    ok thanks
     
Loading...