I am writing some code that will have several functions. I need the functions to have my database connection, is there a way that I can include the connection variable in all functions?

Thanks

I'd suggest writing a class that creates a connection to your database and then each method/function within your class can access the database connection.

Any example of how to do that?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.