MySQL 테이블 리스트 보기 show tables from dbname  DB 관련 함수


다음은 특정 DB의 테이블 목록을 보는 소스이다.

 

<?
$link = mysql_connect("localhost", "root", "apmsetup");
mysql_select_db("hello");

$db_name = "hello"; // hello 대신 db이름을 적는다.

$sql = "show tables from $db_name";
$result = mysql_query($sql);

while ($row = mysql_fetch_row($result)){
echo "$row[0] <br />";
}

mysql_free_result($result);

 ?>

블로그 이미지

itworldkorea

IT korea가 세상(world)을 변화시킨다.

,