정의되지 않은 변수 : BODY

Ksenia

PHP 오류가 있습니다.

  • 심각도 : 알림
  • 메시지 : 정의되지 않은 변수 : BODY
  • 파일 이름 : models / projects_model.php
  • 라인 번호 : 232

변수 $BODY가 정의되지 않은 이유를 이해할 수 없습니다 . 설명해 주시겠습니까? 다음은 내 projects_model 파일입니다.

    private function Modal()
    {
        include APPPATH."language/".LANG.".php";

        $ProjectId = htmlspecialchars($_POST['modal'],ENT_QUOTES);
        $getProject = $this->db->query("SELECT `projectName`,`managerId` FROM `projects` WHERE `projectId`='$ProjectId'");
        if ($getProject->num_rows()>0)
        {
            $project = $getProject->row_array();

            $getUsers = $this->db->query("SELECT * FROM `usertoproject` WHERE `projectId`='$ProjectId' AND `isEnabled`='1'");
            if ($getUsers->num_rows()>0)
            {
                $BODY=''; $line = "";
                foreach ($getUsers->result_array() as $row){
                    $line.=$row['userId'].",";
                    $Post = '';
                    if ($row['isEnabled']==1) $checked = ' checked'; else $checked = '';
                    $getUser = $this->db->query("SELECT `userName` FROM `users` WHERE `userId`='".$row['userId']."'");
                    if ($getUser->num_rows==1)
                    {   
                        if (!empty($row['postId']))
                        {
                            $explodePost = explode(',',$row['postId']);
                            for($p=0;$p<count($explodePost);$p++)
                            {
                                $getPost = $this->db->query("SELECT `postName` FROM `posts` WHERE `projectId`='$ProjectId' AND `postId`='".$explodePost[$p]."'");
                                if ($getPost->num_rows()>0)
                                {
                                    $PostName = $getPost->row_array();
                                    $Post.= $PostName['postName'].', ';
                                }
                            }
                            $Post = mb_substr($Post,0,mb_strlen($Post,"UTF-8")-2,"UTF-8");
                        }
                        $User = $getUser->row_array();
                        $ex = explode(",",$project['managerId']);
                        if (in_array($row['userId'],$ex)) $Post.='<b> '.$LANGUAGE['Manager'].'</b>';

                        $BODY = '<table style="margin-top:1em;margin-bottom:1em;width:100%" id="user'.$row['UTPId'].'">
                        <tr>
                        <td><input type="checkbox" id="check'.$row['UTPId'].'"'.$checked.' onclick="EnableUser('.$row['UTPId'].')"> '.$User['userName'].' <font style="color:#666">('.$Post.')</font></td><td style="text-align:right;margin-right:0.2em">                       
<button type="button" onclick=Delete('.$row['UTPId'].',"usertoproject","UTPId") class="btn btn-danger"><i class="fa fa-trash" aria-hidden="true"></i></button> 
<button type="button" onclick="EditUserToProject('.$row['UTPId'].')" class="btn btn-default"><i class="fa fa-pencil" aria-hidden="true"></i></button><br></td>
</tr></table>';
                    }
                }
            }
            $event = 'event,"user","user",'.$ProjectId;
            echo '<div class="modal-content"><div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <h4 class="modal-title">'.$project['projectName'].'</h4>
            </div>
            <div class="modal-body">
            <input type="text" class="form-control" id="user-search" placeholder="'.$LANGUAGE['SearchPhrase'].'" onchange=Search("user","user",'.$ProjectId.') onkeypress=runScript('.$event.')>
<div style="text-align:center">
<button type="button" class="btn btn-info" onclick=Search("user","user",'.$ProjectId.')>
      <span class="glyphicon glyphicon-search"></span> '.$LANGUAGE['Search'].'</button>
</div>
<div id="user_result">
*232 line:*'.$BODY.'
            </div>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">'.$LANGUAGE['Close'].'</button>
            </div>
          </div>
          <script>
          var options2 = {
    url: function(phrase) {
        return "'.SITEURL.'/'.LANG.'/find/?user="+encodeURIComponent(phrase);
    },
    getValue: "userName"
};

$("#user-search").easyAutocomplete(options2);

          </script>
          ';
        }else echo $this->db->error();
        exit;
    }
KARAN LAGALWAR

@Ksenia if ($ getUsers-> num_rows ()> 0) 먼저이 조건이 참인지 확인한 후이 조건 전에 $ BODY 변수를 선언합니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

TypeError : 정의되지 않은 'body2'속성을 읽을 수 없습니다.

분류에서Dev

jquery의 정의되지 않은 변수

분류에서Dev

`if` 문의 정의되지 않은 변수

분류에서Dev

ErrorException : 정의되지 않은 변수 : 일

분류에서Dev

정의되지 않은 변수 : atts

분류에서Dev

ErrorException 정의되지 않은 변수 $ data

분류에서Dev

정의되지 않은 변수 오류

분류에서Dev

Phalcon 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 출력

분류에서Dev

정의되지 않은 변수 : ... in ... on line 9

분류에서Dev

PHP 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 :이

분류에서Dev

정의되지 않은 변수 laravel 4.1

분류에서Dev

정의되지 않은 쿠키 변수

분류에서Dev

정의되지 않은 변수 PHP?

분류에서Dev

변수 정의되지 않은 범위

분류에서Dev

Matlab 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 : 내용

분류에서Dev

AngularJS에 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 : 결과

분류에서Dev

오류 : 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 $ .parseJSON

분류에서Dev

PDO / PHP 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 | PHP

분류에서Dev

정의되지 않은 변수 : conn in

분류에서Dev

phpmailer 정의되지 않은 변수

분류에서Dev

Observable에 정의되지 않은 변수

분류에서Dev

정의되지 않은 변수 : productChunk

분류에서Dev

Ansible 정의되지 않은 변수