회원중복 다시질문드립니다.^^
본문
lib/register.lib.php 파일에 있는 회원 중복검사 기능에 한가지 더해서,
같은 서버에 있는 다른 계정의 회원 DB에서 추가적으로 중복검색을
해서 결과를 나타내고자 합니다. 개념이 맞는지 알고싶습니다.^^;;
function exist_mb_id($reg_mb_id)
}
global $g5;
$reg_mb_id = trim($reg_mb_id);
if ($reg_mb_id == "") return "";
$sql = " select count(*) as cnt from `{$g5['member_table']}` where mb_id = '$reg_mb_id' ";
$row = sql_fetch($sql);
/* 추가입력 시작*/
$connect = mysql_connect( 'localhost', 'aaaa', 'aaaa_db') or die('Could not connect to mysql server.' );
mysql_select_db('aaaa', $connect) or die('Could not select databaseaa.');
$sql2 = " select count(*) as cnt from `{$g5['member_table']}` where mb_id = '$reg_mb_id' ";
$result2 = mysql_query($sql2,$connect);
$row2 = mysql_fetch_array($result2);
/* 추가입력 끝*/
if ($row['cnt'] || $row2['cnt'] )
return "이미 사용중인 회원아이디 입니다.";
else
return "";
}
답변 1
같은서버라면 테이블앞에 db명을 붙여주시면되요.
select count(*) as cnt from aaaa_db.`{$g5['member_table']}` where mb_id = '$reg_mb_id'
현재 사용중인 mysql계정에 aaaa_db사용권한을 추가해주시고 위에처럼 하시면 되요.
+++++++++++++++추가+++++++++++++++
만약 호스팅업체에서 하신다면 위에 적어주신것처럼 다시연결해야겠지만 연결하실땐 이전연결 끊고! 다른거 연결하고! 작업 끝나면 끊고! 다시 이전디비로 연결하셔야되요. 끊고 연결하는게 중요해요~