we are facing 1064 database error in google chrome browser sometimes. but its working fine in other browsers. please let me know any solutions you have.
Error Code:
A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 select * from tbl_user_rights where usr_id=**
Filename: helpers/common_helper.php
Line Number: 42**
program code:-
function user_has_right($rights_id) {
$CI = get_instance();
$CI->load->model('user_model');
$user_id = $CI->session->userdata('user_id');
$query = $CI->db->query("select * from " . TBL_USERS_RIGHTS . " where usr_id=" . $user_id);
$rights = $query->result();
$user_right = array();
foreach ($rights as $right) {
array_push($user_right, $right->sm_id);
}// print_r($user_right);exit;
if (in_array($rights_id, $user_right)) {
return TRUE;
} else {
return FALSE;
}
}