用php错误严格标准:非静态方法

时间:2018-03-06 02:41:20

标签: php mysqli

在php严格标准中出现此错误:非静态方法ticket :: getTicket()不应在第138行的C:\ xampp \ htdocs \ ticket \ user \ ticket-view.php中静态调用

警告:缺少ticket :: getTicket()的参数1,在第138行的C:\ xampp \ htdocs \ ticket \ user \ ticket-view.php中调用,并在C:\ xampp \ htdocs \ ticket \ user中定义101号线上的\ include \ ticket.php

致命错误:在第102行的C:\ xampp \ htdocs \ ticket \ user \ include \ ticket.php中不在对象上下文中时使用$ this

我做错了什么?。

<div class="content"> <------This is my index.php nothing more.
                        <div class="container-fluid"> 
    <div class="panel panel-primary">
              <div class="panel-heading">Tickets</div>
              <div class="panel-body">
         <a href="ticket-insert.php"><button  type="button" class="btn btn-sm btn-primary btn-create">Create New Tickets</button> </a> 
         <?php tickets::getTicketByUserID(); ?>
        </div>
        </div>

/* function.php page */
    public function getTicketByUserID($id) { <----- my line 101 error 
            $this->id = $id; <------- my line error 102 
                $sql = "select * from tickets where id = " . $this->id ;
                $sql = "select
                            t.*,
                                (select ts.status
                                    from ticketstatus ts
                                        where ts.ticketid = t.id
                                        and ts.statusdate = (select max(ts2.statusdate)
                                                                    from ticketstatus ts2
                                                                    where ts2.ticketid = ts.ticketid)) as status
                                from tickets t
                                    where id = " . $this->id;

                $result = $this->mysqli->query($sql);

                if ($result->num_rows > 0) {
                    // output data of each row
                     while($row = $result->fetch_assoc()) {
                            $this->clientId = $row['clientid'];
                            $this->user = $row['user'];
                            $this->subject = $row['subject'];
                            $this->categoryId = $row['categoryid'];
                            $this->comments = $row['comments'];


                            $this->openDate = $row['opendate'];

                            $this->assignedUser = $row['assigneduser'];
                            $this->status = $row['status'];
                  }
             } else {
                echo "No ticket with that id...";
             }

       } This is where my line 138 ends...

0 个答案:

没有答案