반응형

출처: http://stackoverflow.com/questions/1220030/mysql-fetching-only-one-field


mysql_fetch_object() 메소드는 select 문으로 모든 컬럼을 가져오는데 사용할 수 있으나,

특정 컬럼만 가져올려고 하니 에러가 발생하였다.


이를 해결하기 위해 이 메서드 대신 mysql_result() 메소드를 사용하면 된다.


<?php $sql = "select id from member"; $result = mysql_query($sql); $obj = mysql_result($result, 0); ?>


반응형
Posted by 애콜라이트
l

free counters