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
- 스프링
- log4j
- 이클립스
- Eclipse
- html
- #eclipse
- IntelliJ
- Plugins
- #JVM
- mariadb
- Oracle
- log4j2
- Spring
- #자바
- #java
- #Oracle
- springboot
- 환경설정
- 설치
- CodeGlance
- 플러그인
- 인텔리제이
- 스프링부트
- #자바가상머신
- 설정
- Like
- 소스코드 맵
- 오라클
- #오라클
- #이클립스
Archives
- Today
- Total
커피와 개발자
[MySQL API] mysql_fetch_field() 본문
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_field($res);
$name = $row->name;
$table = $row->table;
$max_length = $row->max_length;
$not_null = $row->not_null;
$primary_key = $row->primary_key;
$unique_key = $row->unique_key;
$multiple_key = $row->multiple_key;
$numeric = $row->numeric;
$blob = $row->blob;
$type = $row->type;
$unsigned = $row->unsigned;
$zerofill = $row->zerofill;
echo ("
name : $name <br>
table : $table <br>
max_length : $max_length <br>
not_null : $not_null <br>
primary_key : $primary_key <br>
unique_key : $unique_key <br>
multiple_key : $multiple_key <br>
numeric : $numeric <br>
blob : $blob <br>
type : $type <br>
unsigned : $unsigned <br>
zerofill : $zerofill <br>
");
? >
</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_field($res);
$name = $row->name;
$table = $row->table;
$max_length = $row->max_length;
$not_null = $row->not_null;
$primary_key = $row->primary_key;
$unique_key = $row->unique_key;
$multiple_key = $row->multiple_key;
$numeric = $row->numeric;
$blob = $row->blob;
$type = $row->type;
$unsigned = $row->unsigned;
$zerofill = $row->zerofill;
echo ("
name : $name <br>
table : $table <br>
max_length : $max_length <br>
not_null : $not_null <br>
primary_key : $primary_key <br>
unique_key : $unique_key <br>
multiple_key : $multiple_key <br>
numeric : $numeric <br>
blob : $blob <br>
type : $type <br>
unsigned : $unsigned <br>
zerofill : $zerofill <br>
");
? >
</body></html>
728x90
'데이터베이스 > SQL' 카테고리의 다른 글
[MySQL API] mysql_fetch_lengths() (0) | 2011.03.03 |
---|---|
[MySQL API] mysql_field_flags() (0) | 2011.03.03 |
[MySQL API] mysql_fetch_assoc() (0) | 2011.03.03 |
[MySQL API] mysql_fetch_array() (0) | 2011.03.03 |
[MySQL API] mysql_escape_string() (0) | 2011.03.03 |
Comments