"Query int"의 두 판 사이의 차이

15번째 줄: 15번째 줄:


[[분류:DB]]
[[분류:DB]]
[[분류:php]]
[[분류:PHP]]
[[분류:함수2]]
[[분류:함수2]]

2012년 1월 2일 (월) 15:50 판

  • 쿼리 결과를 int로 가져오기.
  • 주로 COUNT를 위해 사용.
function intQuery($qry) {
	$result = mysql_query($qry);
	$row = mysql_fetch_array($result, MYSQL_NUM);
	return $row[0];
}

$cnt1 = intQuery("SELECT COUNT(*) FROM table1");
$cnt2 = intQuery("SELECT COUNT(*) FROM table2 WHERE no='1'");
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}