CodeIgniter Forums

Full Version: Translate database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hi fellas,

I have found this code to show database error messages:
$data = array('name' => 'John', 'email' => '[email protected]');
$str = $this->db->insert_string('customers', $data);

// returns null if SQL error occurs.
$res = $this->db->query($str);

if (!$res) {
  // if query returns null
  $msg = $this->db->_error_message();
  $num = $this->db->_error_number();

  $data['msg'] = "Error(".$num.") ".$msg;

It is working perfectly but its showing the error in English, is there a way to translate this message?

Thanks in advance.

El Forum

Use CI Language Class!


El Forum

Hi Insite

The Language Class do not have the string for all errors

For instance, the error for duplicate ID.

Is it possible to translate those messages without the language class?

El Forum

Check the language files in system/language/en/db_lang.php