=== DBCONN.php ====
include_once $_SERVER['DOCUMENT_ROOT']."/common/dbconn.php";
CAFE24에서는 하나의 서버를 여러명이 쓰기 때문에 root를 허용하지 않는다.
DB 또한 계정당 하나씩이다DB명도 카페24아이디 MYSQL ID도 카페24아이디이다.
APM 서버를 로컬에서 띄워서 사용할경우 root가 가능하다.
dbconn.php 내용은 다음과 같다
<? if(!$dbconn)
{
$db_name = "아이디가 DB이름";
$dbconn = mysql_connect("localhost","아이디","MYSQL비밀번호");
$status = mysql_select_db($db_name, $dbconn);
if (!$status) { error("DB_ERROR"); exit; }
}
?>
=== PHP MY ADMIN ====
CAFE24내부 로컬호스트에서 DB를 관리할수 있게 해준다.웹서버 루트 www에 phpmyadmin 폴더가 있어야 한다.
없으면 해당 공식사이트에서 다운받아서 FTP 업로드하면 된다.
http://내아이디.cafe24.com/phpmyadmin/
ID : 내아이디PW : MYSQL비밀번호 (대부분 FTP비밀번호와 동일)
<?
header("Content-Type: text/html; charset=UTF-8");
include_once $_SERVER['DOCUMENT_ROOT']."/common/dbconn.php";
?>
<table border=1 cellpadding="10px">
<tr>
<td width = 100 align ="center">품목명</td>
<td width = 100 align ="center">설명</td>
<td width = 100 align ="center">제품사진</td>
<td width = 100 align ="center">가격</td>
<td width = 100 align ="center"> </td>
</tr>
<?
$qry1="SELECT * FROM my_board ORDER BY idx ASC";
$res1=mysql_query($qry1);
while ($row1=mysql_fetch_array($res1))
{
$cell1= " ".$row1['str2']." ";
$cell2= " ".mb_substr($row1['str3'], 0, 10, 'utf-8').".. ";
$cell3= "<img src='images/".$row1['str5']."' width='100'>";
$cell4= " ".number_format($row1['num1'])." ";
$cell5= "<a href='my_action.php?my_cmd=delete&idx=".$row1['idx']."'>[삭제]</a><BR><BR>";
?>
<tr>
<td><?=$cell1?></td>
<td><?=$cell2?></td>
<td><?=$cell3?></td>
<td align="Right"><?=$cell4?></td>
<td><?=$cell5?></td>
</tr>
<?
}
?>
</table>
<BR><BR>
'WEB DEVELOPER > PHP MYSQL' 카테고리의 다른 글
PHP/MYSQL - 본문 내용중에 HTTP 링크 치환하기 (0) | 2019.09.09 |
---|