Skip to content

Fatal error: Call to a member function num_rows() on a non-object in datamapper.php on line 6321 #13

Description

@ItsJustATypo

Hi,

I'm using DM 1.8.2. I get the error:

Fatal error: Call to a member function num_rows() on a non-object in datamapper.php on line 6321

My DataMapper.php:

    protected function _process_query($query)
    {
        if ($query->num_rows() > 0)   //  <----- this is line 6321
        {

when I execute this query in CI 2.1.0:

$objRules->query($sql);

using this $sql (see explanation below):

CREATE TEMPORARY TABLE IF NOT EXISTS rules_list_1 AS 
(SELECT `rules`.*, `vendors`.`name` AS vendor_name, `accounts`.`name` AS account_name, 
`qb_classes`.`name` AS qb_class_name, 
`account_sys_lookups`.`int_value` AS account_sys_lookup_int_value
FROM (`rules`)
LEFT OUTER JOIN `vendors` vendors ON `vendors`.`id` = `rules`.`vendor_id`
LEFT OUTER JOIN `accounts` accounts ON `accounts`.`id` = `rules`.`account_id`
LEFT OUTER JOIN `qb_classes` qb_classes ON `qb_classes`.`id` = `rules`.`qb_class_id`
LEFT OUTER JOIN `sys_lookups` account_sys_lookups 
ON `account_sys_lookups`.`id` = `accounts`.`type_id`
WHERE `rules`.`user_id` =  1
ORDER BY `rules`.`search_string`)

What this query does:

  • create a temporary table named rules_list_1
  • by pulling the structure and data from the subquery: (SELECT ....)

This query works in phpMyAdmin. It fails when running it within CI and DM.

Any idea what I need to do in order to get this working?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions