엑셀로 등록하는 SQL문좀 봐주십시요~
본문
엑셀로 데이타를 작업하여 업로드하는데........다른필드는 전부 등록이 이상없이 잘되는데
wr_link1만 디비에 등록을 못하는데 뭐가 잘못되었는지모르겠습니다......
에러가나는것도 아니고.......ㅠ.ㅠ
소스코드 첨부합니다.
for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) { //$i == 몇번째 라인부터 등록할건지
$total_count++;
if($_POST[ex_type] == "2"){
$wr_id = addslashes($data->sheets[0]['cells'][$i][1]); //wr_id
$date = addslashes($data->sheets[0]['cells'][$i][2]); //date
$wr_subject = addslashes($data->sheets[0]['cells'][$i][3]); //필드1
$wr_content = addslashes($data->sheets[0]['cells'][$i][4]); //필드1
$wr_link1 = addslashes($data->sheets[0]['cells'][$i][5]); //필드2
$wr_option = addslashes($data->sheets[0]['cells'][$i][6]); //필드3
$ca_name = addslashes($data->sheets[0]['cells'][$i][7]);
/*
$wr_1 = addslashes($data->sheets[0]['cells'][$i][5]); //필드1
$wr_2 = addslashes($data->sheets[0]['cells'][$i][6]); //필드2
$wr_3 = addslashes($data->sheets[0]['cells'][$i][7]); //필드3
$wr_4 = addslashes($data->sheets[0]['cells'][$i][8]); //필드4
$wr_5 = addslashes($data->sheets[0]['cells'][$i][9]); //필드5
$wr_6 = addslashes($data->sheets[0]['cells'][$i][10]); //필드6
$wr_7 = addslashes($data->sheets[0]['cells'][$i][11]); //필드7
$wr_8 = addslashes($data->sheets[0]['cells'][$i][12]); //필드8
$wr_9 = addslashes($data->sheets[0]['cells'][$i][13]); //필드9
$wr_10 = addslashes($data->sheets[0]['cells'][$i][14]); //필드10
*/
$sql = " update {$write_table}
set wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_option = '$wr_option',
ca_name = '$ca_name',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10 = '$wr_10'
where wr_id = '$wr_id' ";
sql_query($sql);
}else{
$mb_id = $member['mb_id'];
$wr_name = $member['mb_nick'];
$wr_password = $member['mb_password'];
$wr_email = $member['mb_email'];
$wr_homepage = $member['mb_homepage'];
$wr_num = get_next_num($write_table);
$wr_reply = '';
$wr_subject = addslashes($data->sheets[0]['cells'][$i][1]); //필드1
$wr_content = addslashes($data->sheets[0]['cells'][$i][2]);
$wr_link1 = addslashes($data->sheets[0]['cells'][$i][3]); //필드1
$wr_option = addslashes($data->sheets[0]['cells'][$i][4]); //필드2
$ca_name = addslashes($data->sheets[0]['cells'][$i][5]); //필드3
$wr_4 = addslashes($data->sheets[0]['cells'][$i][6]); //필드4
$wr_5 = addslashes($data->sheets[0]['cells'][$i][7]); //필드5
$wr_6 = addslashes($data->sheets[0]['cells'][$i][8]); //필드6
$wr_7 = addslashes($data->sheets[0]['cells'][$i][9]); //필드7
$wr_8 = addslashes($data->sheets[0]['cells'][$i][10]); //필드8
$wr_9 = addslashes($data->sheets[0]['cells'][$i][11]); //필드9
$wr_10 = addslashes($data->sheets[0]['cells'][$i][12]); //필드10
$sql = " insert into $write_table
set wr_num = '$wr_num',
wr_reply = '$wr_reply',
wr_comment = 0,
ca_name = '$ca_name',
wr_option = '$html,$secret,$mail',
wr_subject = '$wr_subject',
wr_content = '$wr_content',
wr_link1 = '$wr_link1',
wr_link2 = '$wr_link2',
wr_link1_hit = 0,
wr_link2_hit = 0,
wr_hit = 0,
wr_good = 0,
wr_nogood = 0,
mb_id = '$mb_id',
wr_password = '$wr_password',
wr_name = '$wr_name',
wr_email = '$wr_email',
wr_homepage = '$wr_homepage',
wr_datetime = '".G5_TIME_YMDHIS."',
wr_last = '".G5_TIME_YMDHIS."',
wr_ip = '{$_SERVER['REMOTE_ADDR']}',
wr_1 = '$wr_1',
wr_2 = '$wr_2',
wr_3 = '$wr_3',
wr_4 = '$wr_4',
wr_5 = '$wr_5',
wr_6 = '$wr_6',
wr_7 = '$wr_7',
wr_8 = '$wr_8',
wr_9 = '$wr_9',
wr_10 = '$wr_10'";
sql_query($sql);
$wr_id = sql_insert_id();
// 부모 아이디에 UPDATE
sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");
// 새글 INSERT
sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$mb_id}' ) ");
// 게시글 1 증가
sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");
}//type end
}//for end
답변을 작성하시기 전에 로그인 해주세요.