여기서 $ table 변수에 저장된 테이블 이름에서 필드 이름을 가져 오려고합니다. 필드 이름의 테이블 헤더를 만들고 싶습니다. 어떻게 내가 노력이 접근 방식의 잘못 :데이터베이스 결과에서 필드 이름 가져 오기
<?php
$sql=mysql_query("show fields from $table");
if(mysql_num_rows($sql))
while($res = mysql_fetch_object($sql))
{
?>
<th><?php echo $res->field; ?></th>
<?
}
else
{
echo "No data to display";
}
?>
변경 $의 RES-> 필드; ~ $ res-> fields; –
@JapanPro, 아니'field' 올바른 : http://dev.mysql.com/doc/refman/5.0/en/show-columns.html – binarious
질문 제목을 수정하십시오. 질문을 전혀 설명하지 않습니다. –