개발생활/Web Publishing
php 그누보드 특정 글쓴이만 검색하고싶을때, 변수를 쿼리문에 추가하기
한국인맛집
2022. 5. 25. 15:27
반응형
현재 로그인한 사용자가 쓴글 게시글을 표기하려고한다.
그래서 변수를 id 로 만들고 게시글을 로드해본다
$id = $meber['mb_id'];
아래와 같이 사용하면 mb_id 가 작성한 유저인지 체크할수있다.
$id = $member['mb_id'];
$sq = "select * from g5_write_board where mb_id = '".$id."' ";
$result = sql_query($sq);
만약 본인이 다른 게시글에서 하고싶다면 아래를 수정해서 쓰면 된다.
$id = $member['mb_id']
$sq = "select * from [게시판_보드] where mb_id = '".$id."' ";
$result = sql_query($sq);
Reference
https://stackoverflow.com/questions/7537377/how-to-include-a-php-variable-inside-a-mysql-statement
How to include a PHP variable inside a MySQL statement
I'm trying to insert values in the contents table. It works fine if I do not have a PHP variable inside VALUES. When I put the variable $type inside VALUES then this doesn't work. What am I doing w...
stackoverflow.com
반응형