I was using prepare statement inside mysql stored procedure in codeIgniter 3.1.7framework. Everything works fine when I was working in localhost But when the website was hosted, I got this error "Prepared statement needs to be re-prepared" I checked for solution in too many websites and checked codeigniter , mysql documentation. But still I can't solve it. Almost everyone mentioned to increase "table_definition_cache" in sql. But I tried and still I was getting the same error. Expecting some solution from experts. Thanks in advance.
Asked
Active
Viewed 7,399 times
4
-
I didn't get solution but Someone has down voted my question, Let me know why. – Bergin Jul 07 '18 at 07:41
-
does CI 3.1.7 use PDO? if yes, you can try to emulate prepared statements `PDO::ATTR_EMULATE_PREPARES => true` – Denis Alimov Jul 12 '18 at 12:03
-
I Feel like **yes**... Let me check – Bergin Jul 13 '18 at 04:12
-
@DenisAlimov I changed my database connection from mysqli to pdo.. But still the same result. Everything works good when doing in local host,, After hosted I am getting this error – Bergin Jul 13 '18 at 06:17
2 Answers
1
I was working with Laravel Framework and stuck with the same issue. I googled and tried many solutions but didn't the rid of this issue. Finally, I got this solution and got rid of this issue.
Solution: MySQL: Prepared statement needs to be re-prepared
You can also see these solutions:
I hope this will also work for you.

Gufran Hasan
- 8,910
- 7
- 38
- 51
1
Increase the value of the variable table_definition_cache
It could be increased in line with the sentence SET GLOBAL table_definition_cache=value;
Modify in my.conf file