Skip to content

PHP Notice errors on custom fields when searching #6

@ejmalone

Description

@ejmalone

I started building a search interface against a channel, and quickly found these errors

A PHP Error was encountered
Severity: Notice
Message: Undefined property: CI_DB_mysql_result::$result
Filename: search_fields/pi.search_fields.php
Line Number: 371

A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: search_fields/pi.search_fields.php
Line Number: 371

I believe this is the correct patch (note that the commit message is not relevant, it was against your most recent commit)

From 08cd4c66f6e228fdfef293357ec8b66f9c709275 Mon Sep 17 00:00:00 2001
From: Mark Croxton <mcroxton@hallmark-design.co.uk>
Date: Tue, 7 Jun 2011 07:35:27 -0700
Subject: [PATCH] Minor change to query syntax on line 371

---
 third_party/search_fields/pi.search_fields.php |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/third_party/search_fields/pi.search_fields.php b/third_party/search_fields/pi.search_fields.php
index 6fb1174..e37de80 100644
--- a/third_party/search_fields/pi.search_fields.php
+++ b/third_party/search_fields/pi.search_fields.php
@@ -404,7 +404,7 @@ class Search_fields {

      if ($query->num_rows > 0)
         {
-           foreach ($query->result as $row)
+           foreach ($query->result_array() as $row)
           {
            // assign standard fields
               $this->_cat_fields[$row['site_id']][$row['field_name']] = $row['field_id'];
--
1.7.0.4

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