mysql 관련 헤깔리는 php 함수...???
(1) mysql_fetch_row ()
이건 배열 키값을 숫자로 자동부여하는 거구요..
(2) mysql_fetch_array()
이건 배열 키값을 필드이름으로 자동부여하는 거구요..
하지만 숫자키값으로도 불러올 수 있고..
(3) mysql_fetch_assoc()
필드이름의 키값으로만 배열값을 불러올 수 있고..
(4) sql_fetch_array()
이건 그누보드 전용 함수라고 어디선가 들은 거 같은데 맞나요?
(5) sql_fetch()
이것두 자주 쓰면서 왜 쓰는지 잘 모르겠거든요..ㅠ.ㅠ
차이점을 머리 속에 "콱" 박히게 간단하게 설명 좀 해주실 고수님 좀 기다리겠습니다. ㅠ.ㅠ
댓글 5개
곱슬대마왕
13년 전
전 고수가 아니라 웹서핑정도로 내용을 드릴 수 밖에 없네요..^^;;
http://blog.daum.net/_blog/BlogTypeView.do?blogid=0EwNn&articleno=10908990&categoryId=26®dt=20110426113247#ajax_history_home
http://dever.tistory.com/3
http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=6621&sfl=&stx=&sst=wr_hit&sod=asc&sop=and&page=1691
위 사이트들을 방문해 보시면 설명이 잘 되어 있네요..^^
http://blog.daum.net/_blog/BlogTypeView.do?blogid=0EwNn&articleno=10908990&categoryId=26®dt=20110426113247#ajax_history_home
http://dever.tistory.com/3
http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=6621&sfl=&stx=&sst=wr_hit&sod=asc&sop=and&page=1691
위 사이트들을 방문해 보시면 설명이 잘 되어 있네요..^^
물끄덩미끄덩
13년 전
답변 감사드립니다. 마지막 링크가 많이 도움되었습니다.
13년 전
1,2,3,4번 모두 맞게 보셨고, 4번의 경우 기본 설정은 3번과 같습니다.
1,2,3,4번은 괄호 안에 mysql resource가 들어오고 5번은 쿼리문 자체가 들어오게 됩니다.
5번 = mysql_fetch_assoc(mysql_query('쿼리문'));
이렇게 해서 결과 하나만 가져오는 용도로 사용하고 (때문에 쿼리문에 'limit 1'이 들어오는 경우가 많고)
1,2,3,4번은 loop문으로 돌려서 여러 개의 결과를 가져올 때 많이 사용합니다.
1,2,3,4번은 괄호 안에 mysql resource가 들어오고 5번은 쿼리문 자체가 들어오게 됩니다.
5번 = mysql_fetch_assoc(mysql_query('쿼리문'));
이렇게 해서 결과 하나만 가져오는 용도로 사용하고 (때문에 쿼리문에 'limit 1'이 들어오는 경우가 많고)
1,2,3,4번은 loop문으로 돌려서 여러 개의 결과를 가져올 때 많이 사용합니다.
물끄덩미끄덩
13년 전
말러님 조언 정말 도움 많이 되었습니다. 감사합니다.
13년 전
mysql 관련 책을 한권 구입하셔서 읽어보세요
게시글 목록
| 번호 | 제목 |
|---|---|
| 27980 | |
| 7164 | |
| 31729 | |
| 31726 | |
| 31725 | |
| 31720 | |
| 31711 | |
| 7159 | |
| 27974 | |
| 19734 | |
| 19730 | |
| 19729 |
PHP
[알고리즘] 배열 역순
|
| 27969 | |
| 7142 | |
| 19728 |
jQuery
remove()를 이용하여 엘리먼트 삭제하기
|
| 19725 | |
| 7130 | |
| 19722 |
jQuery
동일 엘리먼트 순번 알아내기
2
|
| 19719 | |
| 7124 | |
| 19718 | |
| 19717 | |
| 19716 |
jQuery
position() 메서드 객체에 대한 좌표값
|
| 19715 | |
| 7122 | |
| 30959 | |
| 19714 | |
| 31710 |
jQuery Mobile
jQuery Mobile 강좌 19. Select Menus
|
| 31709 |
jQuery Mobile
jQuery Mobile 강좌 18. Text Inputs
|
| 19713 | |
| 7117 | |
| 19712 | |
| 7111 | |
| 31708 |
jQuery Mobile
jQuery Mobile 강좌 17. Form Basic
|
| 31707 |
jQuery Mobile
jQuery Mobile 강좌 16. Filters
|
| 19710 | |
| 31706 |
jQuery Mobile
jQuery Mobile 강좌 15. List Content
|
| 31705 |
jQuery Mobile
jQuery Mobile 강좌 14. List Views
|
| 31704 |
jQuery Mobile
jQuery Mobile 강좌 13. Layout Grids
|
| 19709 | |
| 19707 | |
| 31703 |
jQuery Mobile
jQuery Mobile 강좌 12. Tables
|
| 19706 |
jQuery
class가 있는지 없는지 체크하기
|
| 31702 |
jQuery Mobile
jQuery Mobile 강좌 11. Collapsibles
|
| 19705 |
PHP
배열에서 중복 값 없애기
|
| 31701 |
jQuery Mobile
jQuery Mobile 강좌 10. Panels
|
| 19704 | |
| 31700 |
jQuery Mobile
jQuery Mobile 강좌 9. Navigation Bars
|
| 31699 |
jQuery Mobile
jQuery Mobile 강좌 8. Toolbars
|
| 31698 |
jQuery Mobile
jQuery Mobile 강좌 7. Popups
|
| 7107 | |
| 19703 |
JavaScript
str_pad 자릿수만큼 특정문자로 채우기
|
| 31697 |
jQuery Mobile
jQuery Mobile 강좌 6. Icons
|
| 31696 |
jQuery Mobile
jQuery Mobile 강좌 5. Buttons
|
| 19702 | |
| 19701 | |
| 31695 |
jQuery Mobile
jQuery Mobile 강좌 4. Transitions
|
| 27965 | |
| 31694 |
jQuery Mobile
jQuery Mobile 강좌 3. Pages
|
| 19700 | |
| 31693 |
jQuery Mobile
jQuery Mobile 강좌 2. Install
|
| 19699 | |
| 31692 |
jQuery Mobile
jQuery Mobile 강좌 1. Introduction
|
| 31691 |
jQuery Mobile
jQuery Mobile 강좌 0.home
|
| 19698 | |
| 19697 | |
| 19696 |
jQuery
마우스 오버 위치에 따라 툴팁 생성 및 자동 이동
|
| 19694 | |
| 19693 |
jQuery
제이쿼리 동적으로 생성된 객체에 이벤트 생성하기
|
| 19692 | |
| 19691 | |
| 19690 |
JavaScript
shuffle 배열섞기
|
| 19689 |
jQuery
제이쿼리 모음 사이트
|
| 19688 |
PHP
1원팁] IP 대역 비교
|
| 19687 | |
| 7105 | |
| 30955 | |
| 7100 | |
| 19681 |
PHP
input 쉽게 관리하기
5
|
| 7097 | |
| 19678 |
JavaScript
서버시간을 사용한 전자시계
2
|
| 7089 | |
| 7086 | |
| 7084 | |
| 7082 | |
| 19677 | |
| 30953 | |
| 7080 | |
| 7077 | |
| 7071 | |
| 7070 | |
| 7066 | |
| 19676 |
JavaScript
구글 웹사이트 번역기를 내 사이트에 달기
|
| 19674 | |
| 27961 | |
| 7063 | |
| 7061 | |
| 19669 | |
| 7060 | |
| 20842 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기