묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
db목록 뽑아오기 질문이염!
2003.03.07 12:19
나름대루 한다구 했는데 안되네요...
초보라 잘 몰라서 그러는데 틀린부분좀 갈켜주세요..^^
<html>
<head><title></title></head>
<body>
<center>
<?
$connect=mysql_connect( "localhost", "aaa", "bbb") or die( "Unable to connect to SQL server");
$db= dbname ;
$que = "select * from shop_table";
$data = mysql_query($que, $connect);
$total = mysql_affected_rows();
echo("<table border=1> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr>");
for($i=0; $i<$total; $i++)
{
mysql_data_seek($data, $i);
$cd = mysql_fetch_array( $data);
echo"<tr><td>$cd[uid]</td><td>$cd[model]</td><td>$cd[check]</td><td>$cd[name]</td><td>$cd[compname]</td></tr>";
}
echo"</table>";
?>
</center>
</body>
</html>
초보라 잘 몰라서 그러는데 틀린부분좀 갈켜주세요..^^
<html>
<head><title></title></head>
<body>
<center>
<?
$connect=mysql_connect( "localhost", "aaa", "bbb") or die( "Unable to connect to SQL server");
$db= dbname ;
$que = "select * from shop_table";
$data = mysql_query($que, $connect);
$total = mysql_affected_rows();
echo("<table border=1> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </tr>");
for($i=0; $i<$total; $i++)
{
mysql_data_seek($data, $i);
$cd = mysql_fetch_array( $data);
echo"<tr><td>$cd[uid]</td><td>$cd[model]</td><td>$cd[check]</td><td>$cd[name]</td><td>$cd[compname]</td></tr>";
}
echo"</table>";
?>
</center>
</body>
</html>
$db = dbname; 부분을 아래처럼 바꿔주세요...
$db = mysql_select_db("dbname",$connect); //여기서 dbname 대신 DB명을 쓰시면 됩니다.