lisa99 wrote:they only allow 25 mysql connections per cpanel user which seems really low to me.
I agree - seems a bit low. But then again, it's not surprising - shared hosting almost always comes with many drawbacks/limitations like that (e.g. "500 GB bandwidth free!" can easily include a gotcha if you read the fine print, e.g... "... with a daily bandwidth limit of 16 GB ...").
lisa99 wrote:Short of upgrading to a virtual private server (double the price) is there another way this can be addressed?
Though I'm no DB guru, I don't really think so, no. If a page needs information from a DB, then you have to connect to the DB and query for the information... you could consider caching some of the content if it's not dynamic.
lisa99 wrote:Does each query count as a "connection"?
A connection is made when you call mysql_connect() (hence the name) and left open until either a) the script terminates (at which point PHP does some cleaning up and closes any open connections) or b) you manually close the connection, e.g. with mysql_close().
lisa99 wrote:With the low number of users (about 30-50 a day) I don't really see why this is an issue because they aren't all on at the exact same time.
Don't forget to consider spiders/bots such as the ones search engines use. Also don't forget that these bots can be set to crawl several pages simultaneously, so GoogleBot alone could take up several connections at any given point. Then there's MSN, Yahoo, Altavista, etc.
lisa99 wrote:I have not been using mysql_close() because I read in the PHP manual that all connections are closed at the end of the script anyway. Is this correct?
Yes, assuming you aren't using persistent connections (e.g. [man]mysql_pconnect/man). If you have a lot of processing being done after you've finished getting data from your SQL DB, you could always consider using mysql_close() to close the connection as soon as you're done with it, though.