I've only been using DBI for about a week, so forgive the newbie questions.

I'm using cgi-lib and a sql database.
I have a few functions right now to handle my database stuff..(insert,
select, update).
At the beginning of each of these functions, I'm connecting to the DB and at
the end i disconnect.
I'm curious if there is a better way to do this. Because the user will be
clicking many links that re-organize the db it seems a waist to continually
re-connect to it.   However, I don't know of a way (unless i have a logout
button) to know when the user is done with the page.

Also, I read that it's more efficient to prepare your statement once, and
use the bind values.  However, i don't understand how this is possible if
the first time you are doing a SELECT, and the next time a INSERT.  Can I
assign another $sth variable.?  I'm creating a big string to evaluate based
on different parameter each time, and I don't understand how to avoid this.

Any suggestions and comments would be greatly appreciated.

David

Reply via email to