Connecting to DB on different pages with mysql_pconnect

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.

  1. 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?

  2. 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?

You still call connectDB() and assuming the server is configured correctly, and the old connection hasn’t timed out or disconnected for some other reason, it will be found and reused.

There’s nothing wrong with having a .php file for each page.

that puts my mind at least. thanks!