Jump to content

how many connections for several queries


WesleyA

Recommended Posts

This is my situation

 

If variable $conn has all variables (with a value)

     $conn = new mysqli($servername, $username, $password, $dbname);

and then you use

     var_dump($conn);

and the output would be null of all the values of $conn.

 

What would it mean?

 

Am I right the connection then needs to be re-established?

 

I'm doing 2 queries on a database. First query is SHOW TABLES then make the user choose a table value. From this value a new query is done.

 

So first connection is done.

 

But can I use this connection or should I make a new one?

Edited by WesleyA
Link to comment
Share on other sites

var_dump just prints information about the variable, in that case it will print information about the mysqli object you created. It doesn't change the variable. You can use the same connection for as many queries as you want in a single request. Once the request ends then the connection will automatically close, you can't save connections between requests.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...