채택완료

php db쿼리 관련해서 문의드립니다.

2016-11-14 (월) 15:10:17 2,067

아래와 같이  고정값으로 처리를 할 때는 정상적으로 불러오는것은 확인했습니다. 

        <?php

        $unionQ = "  from g5_write_item02  ";

        $mbId   = " and mb_id = 'aaa' ";

        $link   = mysql_connect("localhost","root","a5a5a5");

        mysql_select_db("gabang", $link);

        $sql    = " select wr_regDay {$unionQ} where wr_is_comment =0 {$mbId} order by wr_endDay desc  ";

        $Rquery = mysql_query($sql, $link) or die(mysql_error());  

        $row    = mysql_fetch_array($Rquery);

        $Day = $row['wr_regDay'];

        ?>    

db아이디 aaa의 wr_regDay를 확인이 정상적으로 되는것은 체크했습니다.

로그인 시 마다         

$mbId   = " and mb_id = 'aaa' ";   mb_id가 계속 변경되는데요

 

$member['mb_id'] 값을 어떻게  넣어야 할지...계속 에러가 나서. 

 

|

답변 2개

채택된 답변
+20 포인트

$mbId   = " and mb_id = '".$member[mb_id]."' "; 

 

이렇게 해보세요~..

$mb_id = $member['mb_id'];

​

​$mbId = " and mb_id = '{$mb_id}' ";  

​

​이렇게 변수를 만들어 넣는게 효율적일 겁니다.

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