질문Q #2624
try/catch
앙마2014-03-13 09:28:44
 
try {
            // 유저 아이디와 비밀번호가 맞는지 확인하는 구간
            $userChk = $this->loginmodel->userLogin($userId, $userPass);
            if($userChk != null){
                $userInfo = array(
                       'userId' => $userChk->TC_ID,
                       'userName' => $userChk->TC_NM
                    );
                $this->session->set_userdata($userInfo);
                // 로그인 성공시 status값 0으로 초기화
                $this->loginmodel->statusInit($userId);

                $this->load->view('/WEB_TEACH/head.php');
                $this->load->view('/WEB_TEACH/login/loginSuccess.php');
                $this->load->view('/WEB_TEACH/footer.php');
            }else{
                // 로그인 실패 시 입력받은 사원아이디가 존재하지 않은지 확인하는 구간
                $userExist = $this->loginmodel->userIdCheck($userId);

                if($userExist != null){
                    // 사원 아이디가 존재할 때 비밀번호가 틀렸을 경우 status 증가
                    $this->loginmodel->userPasswordError($userId);                
                }
                $this->load->view('/WEB_TEACH/head.php');
                $this->load->view('/WEB_TEACH/error.php');
                $this->load->view('/WEB_TEACH/footer.php');
            }
        }catch (MySQLDuplicateKeyException $e) {
            echo $e->getMessage();
        }catch (MySQLException $e) {
            echo $e->getMessage();
        }catch (Exception $e) {
            echo $e->getMessage();
        }

php try/catch는 처음 써보는데요

java랑 비슷하기는 한데 제대로 기동되는지 확인해보기 위해서 에러를 내보려 했습니다

없는 테이블로 select 조회를 시켰는데 그냥 ie 에러페이지 형태에서 db에러났다고 뜨네요ㅜㅡ

db는 mysql을 사용중인데 어떻게 수정해야 할까요?

아니면 제가 에러를 잘못 낸 것인가요?



답변2
#1 들국화 2014-03-13 12:03:55
오류 출력을 안하게 해 보세요.

http://www.cikorea.net/user_guide_2.1.0/general/environments.html
#2 변종원(웅파) 2014-03-13 13:08:24
database.php에서 mysql_debug 확인. ^^