2
I am here studying the temporary tables of Mysql, and I am creating some temporary tables. I am using the mysqli
, according to the manual, the temporary tables are erased after the connection is closed.
But the truth is that it doesn’t happen to me, the temporary tables are erased even when I don’t do the close-up connection. It’s either behavior or I’m the one who’s screwing up?
PHP code:
$mysqli = new mysqli(HOST, USER_NAME, PASSWORD, DATA_BASE);
mysqli_set_charset($mysqli, CHARSET);
$sql_create = "CREATE TEMPORARY TABLE ...";
$mysqli->query($sql_create));
//$mysqli->close();
I think you need a little more detail in the example. How are you planning to use the table? Is it all in the same script? remembering that PHP will close the connection anyway at the end of the script.
– Bacco
I saw this article the other day help ? http://imasters.com.br/banco-de-dados/mysql/mysql-e-tabelas-temporarias/
– Motta
@Bacco So there is no way for me to check if the tables were created? It was more for debug, just to make sure that the tables were created and if the content I insert is inserted.
– Jorge B.
@Motta I’ll see, it looks interesting.
– Jorge B.
@Jorgeb. gives, but you have to check in the same script. For example, making a select in this same table just below the creation of it, in the same PHP file (and before the close, because you have to take advantage of the connection that is already open).
– Bacco
@Bacco seems to me to be just that. I don’t know if the question is even pertinent to keep open, but if you want to do the answer.
– Jorge B.
@Bacco that’s right there worked right :)
– Jorge B.
@Jorgeb. post there a well simplified version as answer, can be useful to other people!
– Bacco