I know I could do a simple test for this, but I wanted to know how people do it.
Lets say we’re on productA.php and did a connection to the DB and retrieved some records. The code for the connection is $connect = connectDB();. It uses mysql_pconnect (persistence).
Next we click on product B which brings us to productB.php. And we need to access the DB again.
-
Do we use the same code to connect to DB again? ($connect = connectDB();)?
Will take up another connection slot in mysql? Will it break if there’s a large number of users? -
Is it fine (or a bad practice) to create multiple php pages instead of just one index.php? Example like you have about.php, product.php, profile.php etc. Something like developing the website with html, then converting them to php?