html에서 mysql 테이블 불러오는 방법

mahakhl의 이미지

html에서 mysql 테이블 불러오는 방법좀 알려주세요ㅠㅠ
html안해봐서 인터넷 이곳저곳 찾아서
-------------------------------------------------------------------------------------------------------

<head><title>MySQL Table Viewer</title></head><body>
<center>
	<H2><font face="Helvetica, Arial, Sans Serif">Large CATEGORY</font></H2>
</center>
<TABLE BORDER=1  CELLSPACING=0 CELLPADDING=2>
<?php
$db_host = 'localhost';
$db_user = 'root';
$db_pwd = 'qwe123';
$database = 'CATEGORY';
$table = 'l_category';
 
if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");
 
if (!mysql_select_db($database))
    die("Can't select database");
 
// sending query
$result = mysql_query("SELECT * FROM {$table}");
if (!$result)
{    
 die("Query to show fields from table failed");
}
 
$fields_num = mysql_num_fields($result);
 
echo "<h1>Table: {$table}</h1>";
echo "<table border='1'><tr>";
 
// printing table headers
for($i=0; $i<$fields_num; $i++)
{
    $field = mysql_fetch_field($result);
    echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
 
// printing table rows
while($row = mysql_fetch_row($result))
{
    echo "<tr>";
    // $row is array... foreach( .. ) puts every element    
    // of $row to $cell variable    
    	echo "<td>$row[0]</td>"
    	echo "<td>$row[1]</td>"
    	echo "<td>$row[2]</td>"
    echo "</tr>\n";
}
 
mysql_free_result($result);
?>
</table>
 
</body>

-------------------------------------------------------------------------------------------------------

이런식으로 했는데
제목만 뜨고 table은 눈을 크게뜨고 찾아봐도 .................하나도 안보여요..................................ㅜㅡㅜ

drinkme의 이미지

혹시, 이런거요? chrome이나 firefox로 보세요.

http://linuxstudy.pe.kr/~drinkme/

참고로
위의 page는 html내의 java script가 웹서버로 shell script를 실행시킨 결과를 가져와서
table로 뿌립니다.
shell script는 mysql에 접속하여, 쿼리의 결과를 xml로 보내줍니다.

mithrandir의 이미지

phpmyadmin 같은걸 원하시는걸지도 모르겠네요.

언제나 삽질 - http://tisphie.net/typo/
프로그래밍 언어 개발 - http://langdev.net

언제나 삽질 - http://tisphie.net/typo/
프로그래밍 언어 개발 - http://langdev.net