Jump to content


Photo

mysql connect/close


  • Please log in to reply
5 replies to this topic

#1 thegraingers

thegraingers
  • Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 03 January 2006 - 07:55 PM

sorry about the double posting, my browser errored the first time


USE THe OTHER POST

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 03 January 2006 - 09:42 PM

I assume you mean [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=82506\" target=\"_blank\"]this topic[/a], but there's no post there!?!?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 thegraingers

thegraingers
  • Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 03 January 2006 - 11:08 PM

[!--quoteo(post=332901:date=Jan 3 2006, 09:42 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ Jan 3 2006, 09:42 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I assume you mean [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=82506\" target=\"_blank\"]this topic[/a], but there's no post there!?!?
[/quote]



whooooops, so any answers to my question.............

#4 LazyJones

LazyJones
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 03 January 2006 - 11:22 PM

Answer: "Yes, those mushrooms were very poisonous"

#5 thegraingers

thegraingers
  • Members
  • Pip
  • Newbie
  • 9 posts
  • LocationUK

Posted 03 January 2006 - 11:37 PM

my question, which appears to have been lost is

Is it better on a web page to open a mysql connection at the start of the page, do a number of queries and then close the database connection

OR

if it is possible to split the queries up would it be better to do a number of open, query, close operations.


a typical page might look like this
query for advert selection
query to log advert shown

query for another advert
query to log advert

query to populate part of a side menu
query for a poll in side menu

query for page content

query for another advert
query to log advert

etc

#6 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 04 January 2006 - 12:39 AM

Don't re-connect multiple times... too much overhead. Once per page is always the right way to go.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users