Good morning everyone. May I ask what's wrong with this code? I already tried every solution here at stackoverflow about the duplicate entry but nothing worked. Here's the code..
public function do_add_menu_accounts($chkmenus,$chknamedivsect) {
$sql_check = "SELECT
fsiportaldb2.tbl_user_access.account_id,
fsiportaldb2.tbl_user_access.menu_id,
fsiportaldb2.tbl_accounts.account_id AS account_id1
FROM
fsiportaldb2.tbl_user_access
INNER JOIN fsiportaldb2.tbl_accounts ON fsiportaldb2.tbl_accounts.account_id = fsiportaldb2.tbl_user_access.account_id"
;
$sql="INSERT INTO tbl_user_access (`menu_id`,`account_id`) VALUES (?,?)";
$data = array($chkmenus, $chknamedivsect);
$query_1 = $this->db->query($sql_check,$data);
$query = $this->db->query($sql,$data);
if ($query_1)
{
echo "Values already exist!";
}else{
return $query;
}
}