MySQL 레코드 가져오기 (mysqli_fetch_ row, assoc, array)
참조사이트
PHP MySQL 레코드 가져오기 (mysqli_fetch_row)
- PHP mysqli_fetch_row 란? mysqli_fetch_row 함수는 mysqli_query 를 통해 얻은 리절트 셋(result set...
blog.naver.com
PHP MySQL 레코드 가져오기 (mysqli_fetch_assoc)
- PHP mysqli_fetch_assoc 란? mysqli_fetch_assoc 함수는 mysqli_query 를 통해 얻은 리절트 셋(result...
blog.naver.com
PHP MySQL 레코드 가져오기 (mysqli_fetch_array)
- PHP mysqli_fetch_array 란? mysqli_fetch_array 함수는 mysqli_query 를 통해 얻은 리절트 셋(result...
blog.naver.com
PHP Mysql Fetch Association Vs Fetch Array Vs Fetch Object Performance Analysis
PHP Mysql Fetch Association Vs Fetch Array Vs Fetch Object Performance Analysis In this analysis we will see how the 3 main Mysql data fetching methods in PHP performance under different loads In most programming situations regarding php-mysql you will nee
www.spearheadsoftwares.com
https://stackoverflow.com/questions/64992964/what-is-a-reason-of-using-mysqli-fetch
What is a reason of using mysqli_fetch?
I wanted to ask why should I use (used in foreach -> ) mysqli_fetch_array($result, MYSQLI_ASSOC) if foreach ($result as $row) gives the same result? I'm struggling to understand the benefit of
stackoverflow.com
mysqli_fetch_row : 값(value)만 갖고 있는 배열
mysqli_fetch_assoc : 키(key) 와 값(value)의 쌍형태를 갖는 배열
mysqli_fetch_assoc : 순번을 키로 하는 일반 배열과 컬럼명을 키로 하는 연관배열 둘 모두 값으로 갖는 배열
mysqli_fetch_row : 일반 배열
$row = mysqli_fetch_row($result_set);
print_r($row);
$row : Array ( [0] => 1 [1] => 홍길동 )
while ($row = mysqli_fetch_row($result_set)) {
print_r($row);
}
Array ( [0] => 1 [1] => 홍길동 )
Array ( [0] => 2 [1] => 일지매 )
Array ( [0] => 3 [1] => 임꺽정 )
while ($row = mysqli_fetch_row($result_set)) {
echo 'seq : ' . $row['seq'] . ', name : ' . $row['name'] . '<br>';
}
Warning: Undefined array key "seq" in C:\xampp\htdocs\_test\01.php on line 58
mysqli_fetch_assoc : 연관 배열
$row = mysqli_fetch_assoc($result_set);
print_r($row);
$row : Array ( [seq] => 1 [name] => 홍길동 )
while ($row = mysqli_fetch_assoc($result_set)) {
print_r($row);
}
Array ( [seq] => 1 [name] => 홍길동 )
Array ( [seq] => 2 [name] => 일지매 )
Array ( [seq] => 3 [name] => 임꺽정 )
while ($row = mysqli_fetch_assoc($result_set)) {
echo 'seq : ' . $row['seq'] . ', name : ' . $row['name'] . '<br>';
}
seq : 1, name : 홍길동
seq : 2, name : 일지매
mysqli_fetch_array : 일반 배열 + 연관배열
$row = mysqli_fetch_array($result_set);
print_r($row);
$row : Array ( [0] => 1 [seq] => 1 [1] => 홍길동 [name] => 홍길동 )
while ($row = mysqli_fetch_array($result_set)) {
print_r($row);
}
Array ( [0] => 1 [seq] => 1 [1] => 홍길동 [name] => 홍길동 )
Array ( [0] => 2 [seq] => 2 [1] => 일지매 [name] => 일지매 )
Array ( [0] => 3 [seq] => 3 [1] => 임꺽정 [name] => 임꺽정 )
while ($row = mysqli_fetch_array($result_set)) {
echo 'seq : ' . $row['seq'] . ', name : ' . $row['name'] . '<br>';
}
seq : 1, name : 홍길동
seq : 2, name : 일지매