Call to a member function free_result() on a non-object

1.平时用框架用久了,直接执行原生的sql反而做起来反应迟钝了。今天遇到一个问题,就是直接执行一个添加的sql语句,然后我用了TP框架的M()->query();方法。运行以后,会报Call to a member function free_result() on a non-object这行错误,找了半天也不知道怎么回事,然后找到了 free_result()具体实现方法的地方看了代码,这个方法是释放查询的结果集。然而我执行的是添加操作,也就会报错了。M()->query();是执行查询语句,M()->execute()是增删改sql语句。

2.今天还遇到另一个问题,就是TP框架里面,用了import,vendor,还用了include require,反正是该试的都试了。就是实例化类实例化不到,后来才知道,Tp框架实例化的时候前面要加个  \ 斜杠。\PHPExcel_IOFactory::createReader(‘Excel2007‘); 。

TP框架手册原话:

注意,如果你的类库没有使用命名空间定义的话,实例化的时候需要加上根命名空间,例如:

  1. import(‘Test.UserTest‘);
  2. $test = new \UserTest();
时间: 2024-12-25 06:43:22

Call to a member function free_result() on a non-object的相关文章

Fatal error: Call to a member function read() on a non

选模版时报错如下:Fatal error: Call to a member function read() on a non-object inC:\wamp\www\DedCms5.7\include\dialog\select_templets.php on line 71或者是/include//templets/default/index.htm Not Found!95%的导致原因是本地测试好了之后上传到服务器的路径问题!解决方法:后台->系统->系统基本设置->核心设置 -

'init':member function definition looks like a ctor(构造函数的缩写)

具体编译的错误提示如下:warning C4183: 'init': member function definition looks like a ctor, but name does not match enclosing classwarning C4183: 'method': member function definition looks like a ctor, but name does not match enclosing classLinking...main.exe -

ECmall错误:Call to a member function get_users_count() on a non-object

问题描述: 在后台添加了一个app报错:Call to a member function get_users_count()Fatal error: Call to a member function get_users_count() on a non-object in \includes\ecapp.base.php on line 问题原因有一下几点: 1.你的APP文件没有对应的Lang文件: 2.你的APP文件和Lang文件如果是UTF编码的,可能是有BOM: 3.你的APP文件和

Fatal error: Call to a member function on a non-object 的2种解决办法

这两天被一个莫名其妙的错误:Fatal error: Call to a member function on a non-object in d://www/htdocs/inc.php 77  搞的是晕头转向的.花了两天的功夫也没找出原因.在网上也没有搜索到解决的办法.无奈之下只好一行一行的比对代码,最后终于发现了错误之处:数据库字段错误! 一开始我根本就没有联想到这方面的原因,只是不断的在代码中找原因.无论怎么找都是没问题的,甚至将函数重写也无济于事.之后查看数据库表的时后发现了问题:原来

static 和 no static Member function学习

以下是做实验的一段代码: #include <iostream> using namespace std; typedef void (*p)(); class Object { public: static void s_fun_1() { cout << "static function 1\n"; } void fun_1() {cout << "no static function 1\n";} }; typedef vo

Timer.4 - Using a member function as a handler

In this tutorial we will see how to use a class member function as a callback handler. The program should execute identically to the tutorial program from tutorial Timer.3. #include <iostream> #include <boost/asio.hpp> #include <boost/bind.

Fatal error: Call to a member function getData() on a non-object in /data/php/framework/exts/zii/wid

使用Yii框架的zii.widgets.CListView遇到的错误:zii.widgets.CListView <?php $this->widget('zii.widgets.CListView', array( 'dataProvider' => $order, 'itemView' => '_providerlist', 'emptyText' => '暂无数据', 'itemsTagName'=>'div', 'template'=>'{items}{p

php 写入数据库时Call to a member function bind_param() on a non-object

<?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; // 创建连接 $conn = new mysqli($servername, $username, $password, $dbname); // 检测连接 if ($conn->connect_error) { di

call to member function bind_param() on boolean...........

:  Uncaught Error: Call to a member function fetch_all() on boolean in .... Stack trace: #0 {main}   thrown in ..... 出现这种错误一般是在查询语句中表名不匹配