codeigniter - why am i getting an error from file mysqli/mysqli_driver.php?
I have just uploaded my project to my website server and i am getting this error message when i click on my submit button for my logging in form.
A PHP Error was encountered
Severity: Warning
Message: mysqli_real_escape_string() expects parameter 1 to be mysqli, boolean given
Filename: mysqli/mysqli_driver.php
Line Number: 315
I have absolutely no errors on my local server and i am completely stumped on what the problem is. if some one could please help i would be greatly appreciative and much respect will be given.
My project is using codeigniters framework.
Answer
Solution:
Go to
mysqli_driver.php
to Line #315 and put an at mark in fron of the command to supress the warning.From:
To:
If the value you are escaping is an integer, then use intval() instead:
This will turn a NULL into a Zero
Answer
Solution:
Instead of hide warnings with @, check that conn_id is not false:
change
like that
Answer
Solution:
My solution was to initialize the connection if it is not available. Change line #315:
Answer
Solution:
I met this problem too. Wolfgang's solution works well for me.
And if you use codeIgniter, change database config
$db['default']['autoinit'] = TRUE;
can also solve the problem.