0

Mysqli_connect() works well when I am on my local server. But, now that I'm on the live server, it does not work. However, Mysqli_error() does not show any error message. I tried to use error_reporting(E_ALL) and ini_set("display_errors", "on") to force mysqli_error() to return an error message but it does not. But I must mention that: when I enter consciously a bad parameter to mysqli_connect() (like a bad password), then mysqli_error() return an error.

Please help me

C.LEGRAND
  • 1
  • 2
  • 1
    How do you know it "does not work"? How do you know it's Mysqli_connect() and not something else? – Your Common Sense Jun 14 '22 at 18:20
  • https://www.php.net/manual/en/mysqli.connect-error.php should be used for connection error. Are systems using same PHP version, and both (this one) have mysqli enabled? – user3783243 Jun 14 '22 at 18:21
  • Add `mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);` before your `mysqli_connect()` (or `new mysqli()`) command, and this will ensure that errors with your SQL queries are reported correctly to PHP automatically. – ADyson Jun 14 '22 at 18:39
  • 2
    @user3783243 better to switch on overall automatic mysqli error reporting than to rely on the old-fashioned individual error reporting – ADyson Jun 14 '22 at 18:40

0 Answers0