개발
PHP의 mysql 관련 함수에서 @(골뱅이) 의 의미
마스타
2015. 2. 6. 11:38
300x250
ㅁ PHP 에서 @(골뱅이)의 의미
php 에서 함수 앞에 @(골뱅이) 를 붙이는 것은 에러 메시지를 표시하지 말라는 의미이며, php 의 대부분의 구문에서 적용 가능하다.
꼭 mysql 관련 함수에서만 적용되는 것은 아니라는 말이다.
@include_once xxxxxxxx;
@echo "xxxxx";
====
ㅁ PHP의 mysql 관련 함수에서 @(골뱅이) 의 의미
PHP 프로그래밍을 하다 보면, mysql 관련 함수들 사용시에 아래와 같은 메시지를 만날 경우가 있다.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/test.php on line 135
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/test.php on line 135
엄밀히 말하면, 오류는 아니고 경고 이지만, 소스를 적절하게 수정하여 메시지를 피하는 것이 정답이다.
하지만, 단순히 메시지를 표시되지 않게 하려면, 함수 앞에 @ 를 붙이면 된다.
mysql_query()
mysql_fetch_arrow()
mysql_num_rows()
@mysql_query()
@mysql_fetch_arrow()
@mysql_num_rows()
* 출처 :
http://php.net/manual/kr/language.operators.errorcontrol.php
http://happyjung.com/bbs/board.php?bo_table=lecture&wr_id=1145
300x250