"; // Pour débogage, tu peux aussi loguer cette erreur dans un fichier // error_log($error_message); return "ERROR: Could not connect to DB2. Check connection string and ODBC setup."; // Retourne une erreur pour éviter l'appel à odbc_exec } $rs = odbc_exec($conn, $request); // Ton code existant après la connexion if (strpos(strtoupper($request), "SELECT") !== false) { // strpos est plus robuste que instr ici en PHP $answer = []; // Initialize array to prevent undefined variable warning while ($row = odbc_fetch_array($rs)) { $answer[] = $row; } } if (isset($answer)) { return $answer; } else { if ($rs) { return "OK"; } else { // If odbc_exec failed error_reporting(E_ALL); // Re-enable for this specific error if needed return "ERROR : " . odbc_errormsg($conn); } }