제발답변좀요~! write_update.php에 여유필드 입력하는법좀.. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

제발답변좀요~! write_update.php에 여유필드 입력하는법좀.. 정보

제발답변좀요~! write_update.php에 여유필드 입력하는법좀..

본문

네이버 지도의 좌표값 x,y 를 여유필드 wr_9, wr_10 에 직접 입력해서

출력시키는 기능을 구상하고 있는데 아무도 답변을 안해주시네요...


write.php 에 입력된 wr_9, wr_10 좌표 값을 write_update.php 에 업데이트하려고하는데

좀 도와주세요...

======================write.php 에 기록한 소스=========================
<input name=wr_9 itemname="wr_9" value="<?=$write[wr_9]?>">
<input name=wr_10 itemname="wr_10" value="<?=$write[wr_10]?>">

======================================================================


write_update.php 소스입니다...

=====================================================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 자신만의 코드를 넣어주세요.
//우편번호
$wr_1 = "$tmp_00-$tmp_01";
$sql = " update $write_table set wr_1 = '$wr_1' where wr_id = '$wr_id' ";
sql_query($sql);
// 네이버 지도 좌표 등록 시작
// 여기부터 주소 검색 xml 받아오기
$map_key = "key=".$board[bo_1];
$map_query = str_replace(" ","%20",$wr_2);
$pquery = $map_key. "&query=". $map_query;
$fp = fsockopen ("map.naver.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)";
} else {
fputs($fp, "GET /api/geocode.php?");
fputs($fp, $pquery);
fputs($fp, " HTTP/1.1\r\n");
fputs($fp, "Host: maps.naver.com\r\n");
fputs($fp, "Connection: Close\r\n\r\n");

$header = "";
while (!feof($fp)) {
$out = fgets ($fp,512);
if (trim($out) == "") {
break;
}
$header .= $out;
}

$mapbody = "";
while (!feof($fp)) {
$out = fgets ($fp,512);
$mapbody .= $out;
}

$idx = strpos(strtolower($header), "transfer-encoding: chunked");

if ($idx > -1) { // chunk data
$temp = "";
$offset = 0;
do {
$idx1 = strpos($mapbody, "\r\n", $offset);
$chunkLength = hexdec(substr($mapbody, $offset, $idx1 - $offset));

if ($chunkLength == 0) {
break;
} else {
$temp .= substr($mapbody, $idx1+2, $chunkLength);
$offset = $idx1 + $chunkLength + 4;
}
} while(true);
$mapbody = $temp;
}
// header("Content-Type: text/xml; charset=utf-8");
fclose ($fp);
}   
// 여기까지 주소 검색 xml 받아오기





☆☆☆☆☆☆☆☆☆ 문제의 부분☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆

// 여기부터 좌표값 변수에 무식하게 등록
$map_x_point_1=explode("<x>", $mapbody);
$map_x_point_2=explode("</x>", $map_x_point_1[1]);
$map_x_point=$map_x_point_2[0];

$map_y_point_1=explode("<y>", $mapbody);
$map_y_point_2=explode("</y>", $map_y_point_1[1]);
$map_y_point=$map_y_point_2[0];
// 여기까지 좌표값 변수에 무식하게 등록

☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆


$sql_map = " update $write_table
set wr_3 = '$map_x_point|$map_y_point'
  where wr_id = '$wr_id' ";
sql_query($sql_map);
// 네이버 지도 좌표 등록 끝
?>


제가 ☆☆☆문제의 부분☆☆☆☆ 이라고 언급한 부분만

구문을 wr_9, wr_10 의 값으로 전송하도록 바꾸면 쉽게 해결될것같은데요..

어떻게 해야될지 모르겠습니다..
 
 

참고로
$map_x_point_1='view[wr_9]';
$map_y_point_1='view[wr_10]'; 
 
이렇게 하면 지도가 전혀 출력되지않고 좌표값 표시도 안되는듯하더군요.....

댓글 전체

정확한 질문의 의도를 모르겠습니다.
단지 현재 x,y 값이 wr_3에 저장이 되는군요.
만일 wr_9, wr_10에 저장하길 원하신다면
아래의 부분을 수정해 주시면 될것 같네요.

$sql_map = " update $write_table
set wr_3 = '$map_x_point|$map_y_point'
  where wr_id = '$wr_id' ";

--- 다음으로 수정 ------
$sql_map = " update $write_table
set wr_9 = '$map_x_point', wr_10 = '$map_y_point'
  where wr_id = '$wr_id' ";
write.skin.php에서 wr_9와 wr_10의 값을 받았다면
위의 update에서 두개의 값을 직접넣어주면 됩니다.

$sql_map = " update $write_table
              set wr_9 = '$wr_9',
                  wr_10 = '$wr_10'
        where wr_id = '$wr_id' ";
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT