
mysqli::query() 함수는 데이터베이스에 쿼리를 실행하여 결과를 반환합니다. 반환값은 mysqli_result 객체입니다.
mysqli_result 객체를 사용하여 결과를 얻을 수 있습니다.
예를 들어, 다음과 같이 쿼리를 실행하고 결과를 얻을 수 있습니다.
#hostingforum.kr
php
$query = mysqli_query($conn, "SELECT * FROM 테이블명");
$result = mysqli_fetch_assoc($query);
mysqli_fetch_assoc() 함수는 쿼리 결과에서 한 행을 배열로 반환합니다.
또한, mysqli_fetch_array(), mysqli_fetch_row(), mysqli_fetch_object() 함수도 사용할 수 있습니다.
#hostingforum.kr
php
// mysqli_fetch_array()
$result = mysqli_fetch_array($query, MYSQLI_ASSOC);
// mysqli_fetch_row()
$result = mysqli_fetch_row($query);
// mysqli_fetch_object()
$result = mysqli_fetch_object($query);
이러한 함수를 사용하여 쿼리 결과를 얻을 수 있습니다.
2025-03-11 22:29