I have a question about performance and good coding in general.
I have made a function that connects to a MySQL db, makes a query with passed string argument, return the result, and closes the connection to db.
My program calls this function up to three times in a row when a requirement is met.
Do I gain much performance if I change the code to just connect once, do my queries, then disconnect from db? Does it make any difference?