250x250
Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
Tags
- Plugins
- 스프링부트
- #자바
- 이클립스
- log4j2
- #이클립스
- #java
- log4j
- 설치
- 스프링
- 소스코드 맵
- 설정
- #JVM
- 환경설정
- Oracle
- 인텔리제이
- Spring
- #Oracle
- html
- mariadb
- #eclipse
- Eclipse
- Like
- #오라클
- IntelliJ
- springboot
- #자바가상머신
- 플러그인
- 오라클
- CodeGlance
Archives
- Today
- Total
커피와 개발자
[MySQL API] mysql_fetch_row() 본문
728x90
질의 결과에 대해서 한 줄의 데이터를 배열로 가져온다.
【예제】
<html><body>
< ?
$con=mysql_connect("localhost","root","root_password");
$db=mysql_select_db("mydb",$con);
$query="select * from employees";
$res=mysql_query($query);
$fields=mysql_num_fields($res);
$row=mysql_fetch_row($res);
for($i=0; $i<$fields; $i++) {
echo "$row[$i] ";
}
echo "<br>";
$row=mysql_fetch_row($res);
for($i=0; $i<$fields; $i++) {
echo "$row[$i] ";
}
? >
</body></html>
【예제】
<html><body>
< ?
$con=mysql_connect("localhost","root","root_password");
$db=mysql_select_db("mydb",$con);
$query="select * from employees";
$res=mysql_query($query);
$fields=mysql_num_fields($res);
$row=mysql_fetch_row($res);
for($i=0; $i<$fields; $i++) {
echo "$row[$i] ";
}
echo "<br>";
$row=mysql_fetch_row($res);
for($i=0; $i<$fields; $i++) {
echo "$row[$i] ";
}
? >
</body></html>
728x90
'데이터베이스 > SQL' 카테고리의 다른 글
| [MySQL API] mysql_num_rows() (0) | 2011.03.03 |
|---|---|
| [MySQL API] mysql_field_len() (0) | 2011.03.03 |
| [MySQL API] mysql_fetch_object() (0) | 2011.03.03 |
| [MySQL API] mysql_fetch_lengths() (0) | 2011.03.03 |
| [MySQL API] mysql_field_flags() (0) | 2011.03.03 |
Comments