묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
주소록을 만들고 있습니다. 그런데 테이블을 삽입하면 오류가 자꾸 뜹니다.
2004.03.14 20:22
주소록을 만들고 있는데 테이블을 만들어서 디비에서 이름, 주소, 전화번호 등을 가지고와
테이블안에 출력을 해주고싶은데 자꾸 오류가 납니다. 책보고 해보고있는데 정말 잘안되서
이렇게 질문 드립니다. 아직 공부한지 일주일밖에 안된 초보라서 너무나 난감합니다. 도움주셨으면 합니다.
제 소스 입니다..
###################################################################################
<html>
<head>
<title>Address Book</title>
</head>
<body>
<?php
include "dbcon.inc";
$query = "select * from address order by name";
$result = mysql_query($query);
$total = mysql_num_rows($result);
$page_size = 50;
$page_max = ceil($total / $page_size);
echo("
<table width = 80% align = center>
<tr>
<td colspan = 3>$nbsp</td>
</tr>
<tr>
<td align = center colspan = 5>
<img src='http://kyunggi58.we.ly/addressimg.jpg'>
</td>
</tr>
<tr>
<td align = right colspan = 6>$page_num/$page_max</td>
</tr>
");
$offset = ($page_num - 1) * $page_size;
mysql_data_seek($result, $offset);
for($i = 0; $i < $page_size && $offset < $total; $i++, $offset++) {
$info = mysql_fetch_array($result);
if($i %2 == 0)
$color = "#FBFBFB";
else
$color = "#D9EFB9";
echo("
<p style="text-align:left;"> </p> <----------------------------- 여기서 자꾸 오류가 납니다..
<table style="text-align:left;" align="center" border="1" cellspacing="0" width="640" bgcolor="white" bordercolordark="black" bordercolorlight="black">
<tr>
<td width="75" height="24" valign="top" colspan="2" bgcolor="#CCCCCC" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"> </p>
</td>
<td width="555" height="24" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"> </p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
주 소</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)$info[address2]</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장)$info[address]</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
전화번호</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장1)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장2)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(기타)</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
F A X</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장)</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
E - mail</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
</tr>
</table>
");
}
echo("</table>");
echo("<table width = 80% align = center>
<tr>
<td align = center>
");
for($page = 1;$page <= $page_max; $page++)
if($page == $page_num)
echo("<font size = 4>[$page] </font>");
else
echo("<font size = 4>
<a href = address_list.php?page_num=$page>[$page]</a>
 
</font>
");
echo("<tr>
<td align = center colspan = 5>
<a href='http://kyunggi58.we.ly/bbs/zboard.php?id=editaddress'><img src='http://kyunggi58.we.ly/edit.jpg'>
</a></td>
</tr></table></body></html>");
?>
########################################################################
어디가 잘못된건지 꼭 좀 설명 부탁 드립니다... 수고하십시오.
테이블안에 출력을 해주고싶은데 자꾸 오류가 납니다. 책보고 해보고있는데 정말 잘안되서
이렇게 질문 드립니다. 아직 공부한지 일주일밖에 안된 초보라서 너무나 난감합니다. 도움주셨으면 합니다.
제 소스 입니다..
###################################################################################
<html>
<head>
<title>Address Book</title>
</head>
<body>
<?php
include "dbcon.inc";
$query = "select * from address order by name";
$result = mysql_query($query);
$total = mysql_num_rows($result);
$page_size = 50;
$page_max = ceil($total / $page_size);
echo("
<table width = 80% align = center>
<tr>
<td colspan = 3>$nbsp</td>
</tr>
<tr>
<td align = center colspan = 5>
<img src='http://kyunggi58.we.ly/addressimg.jpg'>
</td>
</tr>
<tr>
<td align = right colspan = 6>$page_num/$page_max</td>
</tr>
");
$offset = ($page_num - 1) * $page_size;
mysql_data_seek($result, $offset);
for($i = 0; $i < $page_size && $offset < $total; $i++, $offset++) {
$info = mysql_fetch_array($result);
if($i %2 == 0)
$color = "#FBFBFB";
else
$color = "#D9EFB9";
echo("
<p style="text-align:left;"> </p> <----------------------------- 여기서 자꾸 오류가 납니다..
<table style="text-align:left;" align="center" border="1" cellspacing="0" width="640" bgcolor="white" bordercolordark="black" bordercolorlight="black">
<tr>
<td width="75" height="24" valign="top" colspan="2" bgcolor="#CCCCCC" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"> </p>
</td>
<td width="555" height="24" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"> </p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
주 소</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)$info[address2]</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장)$info[address]</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
전화번호</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장1)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장2)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(기타)</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
F A X</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(자택)</font></span></p>
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">(직장)</font></span></p>
</td>
</tr>
<tr>
<td width="71" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p align="left" style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체">•
E - mail</font></span></p>
</td>
<td width="0" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
<td width="555" valign="top" bordercolor="white" bordercolordark="white" bordercolorlight="#666666">
<p style="text-align:left;"><span style="font-size:9pt;"><font face="돋움체"> </font></span></p>
</td>
</tr>
</table>
");
}
echo("</table>");
echo("<table width = 80% align = center>
<tr>
<td align = center>
");
for($page = 1;$page <= $page_max; $page++)
if($page == $page_num)
echo("<font size = 4>[$page] </font>");
else
echo("<font size = 4>
<a href = address_list.php?page_num=$page>[$page]</a>
 
</font>
");
echo("<tr>
<td align = center colspan = 5>
<a href='http://kyunggi58.we.ly/bbs/zboard.php?id=editaddress'><img src='http://kyunggi58.we.ly/edit.jpg'>
</a></td>
</tr></table></body></html>");
?>
########################################################################
어디가 잘못된건지 꼭 좀 설명 부탁 드립니다... 수고하십시오.
<p style="text-align:left;"> // 이곳 뿐만 아니라 계속해서 " 큰 따옴표를 쓰셨네요...
echo( " ------" ); 안에는 " 는 사용해서는 안됩니다