mysql performance for php calls -


i have multiple php functions code , each function tries setup mysql connection, send queries , closes mysql connection. design or should set 1 connection master function , pass variables each of these functions execute queries?

also, possible code give errors when trying execute 2nd instance of mysql_query in func1() ? won't instance of mysql connection called in func2 independent instance called in func1? in code, seem inconsistent behaviors. @ times, getting error when refresh page, there seems no problem. suggestions welcome. thanks.

def func1() {  mysql_connect(params)  mysql_query()  func2()  mysql_query()  mysql_close()  }   def func2() {  mysql_connect(params)  mysql_query()  mysql_close()  } 

i can't it's awful performance hit, has no sense.
database connection intended opened once.
if need 5 apples box - open , close box 5 times? or open , @ once? ;-)
same here.

just open connection once , never close it. done automatically.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -