Frage

On my site I use several php pages on which I have to call data from a mysql db using prepared statements.

Suddenly I'm having this intermittent error message "Can't create more than max_prepared_stmt_count statements" and stops the page from loading. I wait a little while and every thing works normal again.

I ran a show global status like 'com_stmt%' and this is what it shows:

Com_stmt_close  11305830
Com_stmt_execute    12109430
Com_stmt_fetch  0
Com_stmt_prepare    12109475
Com_stmt_reset  0
Com_stmt_send_long_data 75

On all pages I close the statement and the PDO only once at the bottom of the page, like this:

$mysqli->close();
$pdo = null;

Now I have 2 questions:

1 - If I have to open 2 or 3 queries on one single PHP page, do I have to close them one by one? or do I close them all at the end of the page? with the above script?

2- If the answer for the first question is "you can close them just once at the end of the page" then please tell me why am I having this error?

Thank you in advance for any help!

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top