php - An error in SQL syntax -


the sql statement follows:

$sql = " insert usertable (     userid,,     name,     username,     password,     typeofuser,     dateofaddition,     createdby,     status ) values (      $userid,     '$empname',     '$username',     '$password',     '$usertype',     '$doa',     '$createdby',     '$radiobt' ) "; 

remove comma after userid , correctly include variables

$sql = "insert usertable     (         userid,         name,         username,         password,         typeofuser,         dateofaddition,         createdby,         status     ) values     (         ".$userid.",         ".$empname.",         ".$username.",         ".$password.",         ".$usertype.",         ".$doa.",         ".$createdby.",         ".$radiobt."     )"; 

make sure prepare statement before getting db! (more info: prepared statement (wikipedia))


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -