테스트 사이트 - 개발 중인 베타 버전입니다

헷갈리는 질문이요 ; 채택완료

포도폴라포 10년 전 조회 2,558
qry문에서 id="abc"와같이 큰따옴표로 되어있어야 되잖아요 그런데 아래와같은경우에 "$rid"이런식으로 하면 문제가 생기는거 같은데 이거 해결코드좀 적어주세요 제가 완전생초보라서요 ;;


$rid = $_REQUEST[rid]; 
$qry="select num,id,category,date2,star,board from board where num=(select num from keep where id = "$rid")order by num desc;";

 

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

답변 1개

채택된 답변
+20 포인트
10년 전

문자와 문자의 연결은 . (쩜) 으로 하시면 됩니다.

 

</p><p> </p><div class="container"><div class="line number1 index0 alt2"><code class="php variable">$rid</code> <code class="php plain">= </code><code class="php variable">$_REQUEST</code><code class="php plain">[rid];</code> </div><div class="line number3 index2 alt2"><code class="php variable">$qry</code><code class="php plain">=</code><code class="php string">"select num,id,category,date2,star,board from board where num=(select num from keep where id = ".</code><code class="php variable">$rid.</code><code class="php string">")order by num desc;"</code><code class="php plain">;</code></div></div><p> </p><p>
 

 

로그인 후 평가할 수 있습니다

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

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

로그인