채택완료

로그인체크안에 넣을 소스 입니다. 어디가 잘못되었을까요

2021-03-29 (월) 19:38:49 2,287

//g5`1hoowon`
$sql2 = "select name, mb_id, hp, bokgo_code, bokgo_Money from `1hoowon` where mb_id = '$mb_id' ";
$sql22= sql_query($sql2);
$sql222 = sql_fetch_array($sql22);

//g5멤버 
$sql5 = ("select mb_signature,mb_hp,mb_profile from {$g5['member_table']} where mb_id = '{$sql222['mb_id']}' ");
$sql25= sql_query($sql5);
$sql225 = sql_fetch_array($sql25);

|

답변 2개

채택된 답변
+20 포인트

bbs/login_check.php 화일에서 사용하는 쿼리가 맞나요?

$sql22= sql_query($sql2);
$sql222 = sql_fetch_array($sql22);

-->두개를 합친 것 sql_fetch()

1hoowon 라는 테이블에 mb_id가 하나씩만 저장 되어있나요?

그렇다면 아래처럼 (변수명을 왜 복잡하게 만드는가요?)

$row =sql_fetch("select name, mb_id, hp, bokgo_code, bokgo_Money from `1hoowon` where mb_id = '$mb_id' ");

$row2 = sql_fetch("select mb_signature,mb_hp,mb_profile from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ");

print_r($row2);

2021-03-29 (월) 19:58:22

$sql5 = ("~");

=> 괄호가 잘못된 듯 합니다.

sql 문은, $sql 변수로..

where 조건을 통해 하나의 레코드만 가져오는 경우에는 sql_fetch() 를 통해 가져오는 것이 좋고.. 변수명은 $row 를 쓰는 것이 좋습니다.

Copy
//g5`1hoowon`
$sql = "select name, mb_id, hp, bokgo_code, bokgo_Money from `1hoowon` where mb_id = '{$mb_id}' ";
$row = sql_fech($sql);

//g5멤버 
$sql = "select mb_signature,mb_hp,mb_profile from {$g5['member_table']} where mb_id = '{$row['mb_id']}' ";
$row = sql_query($sql);

echo $row['mb_signature'];

답변을 작성하려면 로그인이 필요합니다.