源码

php – mysqli :: query():无法获取mysqli


Warning: mysqli::query(): Couldn’t fetch mysqli in C:/Program Files (x86)/EasyPHP-DevServer-13.1VC9/data/localweb/my portable files/class_EventCalendar.php on line 43

以下是我的连接文件:

connect_errno) {

    // Add error to errors array
    $ErrorMsgs[]="The database server is not available.".
               " Connect Error is ".$DBConnect->connect_errno." ".
               $DBConnect->connect_error.".";
}
?>

这是我的班级:

 DBConnect = $DBConnect;  
        }

        function __destruct() {
            if (!$this->DBConnect->connect_error) {
                $this->DBConnect->close();
            }
        }

        function __wakeup() {
            // Include the database connection data
            include("inc_LadleDB.php");     
            $this->DBConnect = $DBConnect;
        }


        // Function to add events to Zodiac calendar
        public function addEvent($Date, $Title, $Description) {
            // Check to see if the required fields of Date and Title have been entered
            if ((!empty($Date)) && (!empty($Title))) {
                /* if all fields are complete then they are 
                   inserted into the Zodiac event_calendar table */
                $SQLString = "INSERT INTO tblSignUps".
                           " (EventDate, Title, Description) ".
                           " VALUES('$Date', '$Title', '".
                            $Description."')";

                // Store query results in a variable
                $QueryResult = $this->DBConnect->query($SQLString);

我对OOP PHP不太满意,我不确定为什么会出现这个错误.我从其他地方提取了这个代码,我唯一改变的是@new mysqli参数.任何人都可以帮我理解出了什么问题吗?

(0)

本文由 投稿者 创作,文章地址:https://blog.isoyu.com/archives/php-mysqli-querywufahuoqumysqli.html
采用知识共享署名4.0 国际许可协议进行许可。除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:9 月 18, 2019 at 08:23 下午

热评文章