mysqli_fetch_assoc
mysqli_fetch_assoc 함수는 mysqli_query 를 통해 얻은 리절트 셋(result set)에서 레코드를 1개씩 리턴해주는 함수입니다.
레코드를 1개씩 리턴해주는 것은 mysqli_fetch_row 와 동일하지만 mysqli_fetch_assoc 함수가 리턴하는 값은 연관배열(자료구조의 하나로 key 하나와 값 하나가 연관되어 있으면 키를 통해 연관되는 값을 얻을수 있음)
이라는점이 틀립니다.
<?php
//mysql_fetch_assoc예제
$conn = mysqli_connect("localhost","hansol","1234","member");
$query = "select id,name from blogin";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);
echo '$row : ';
print_r($row);
echo '<br>';
mysqli_close($conn);
?>
$row : Array ( [id] => 1 [login_pw] => 2 )
mysqli_fetch_row
리절트 셋에서 레코드를 1개씩 리턴해주는 건 똑같지만 mysqli_fetch_row 리턴하는 값은 일반배열 형태 입니다
[DB] mariadb 한글 깨짐 인코팅 설정 utf8 (0) | 2021.10.19 |
---|---|
mariadb root 비빌번호 설정 (0) | 2021.09.28 |
View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them (2) | 2021.08.31 |
Incorrect table definition; there can be only one auto column and it must be defined as a key auto_increment (0) | 2021.08.23 |
mysql 기본적인 명령어 select,alter,drop (0) | 2021.08.09 |
댓글 영역