Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ItsJustATypo opened this issue Oct 6, 2015 · 0 comments

Comments

@ItsJustATypo
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant