Hello Guyz Need Help
This is error when i try to add duplicate country names.
Error Number: 1062
Duplicate entry ‘italy ’ for key ‘Country_Name_UNIQUE’
INSERT INTO `country` (`fkContinent_id`, `Country_Name`, `Country_ShortName`, `Country_Url`, `Country_PageTitle`, `Country_MetaKeywords`, `Country_MetaDescription`, `Country_PageContent`, `Country_Ext`) VALUES (‘11’, ‘italy ‘, ‘’, ‘italy-’, ‘’, ‘’, ‘’, ‘’, ‘’)
Filename: C:\xampp\htdocs\score\system\database\DB_driver.php
Line Number: 330
My Controller :
function add()
{
authenticate();
if(submitted())
{
$arr = explode(".", $_FILES['picture']['name']);
$_POST['Country_Ext'] = $ext = $arr[count($arr)-1];
$this->db->insert("country", $_POST);
$path = "images/country/{$_POST['Country_Url']}.{$ext}";
move_uploaded_file($_FILES['picture']['tmp_name'], $path);
redirect("admins/country/index/added");
}
$data['content'] = $this->load->view("admin/country/add", array(), true);
$this->load->view("admin/template", $data);
}i wanted to print this error msg on my page to avoid this sql error on page i m new please help
Thanks