I know you can´t close connections like in mysqli
, but in my code I execute many queries. For some reason after to many queries the page will just keep loading.
So to fix this, I put my $conn
variable on null and then make a new PDO
connection. But I don´t think that´s the right way to do it.
So my question is: Is there a better way to reconnect or execute many PDO
queries?
for example:
$stmt = $conn->prepare("select * from table");
$stmt->execute();
$result = $stmt->fetchAll();
So if I execute this like 10 times or something then it just stops working. Only way to get it to work is by making $conn null and then start a new connection.