Jump to content

how many connections for several queries

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


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...