Welcome Guest, Not a member yet? Register   Sign In
I'm getting "Call to undefined function where()"
#1

I searched google with "call to undefined where() function codeigniter -redirect -model -encrypt -set_value -method -link_tag -img -lang -newRandomPwd -base_url -form_open -site_url -curl_init" and looked at all 26 pages of hits returned by this search, but none of them concerned the where clause.

I'm using CodeIgniter version 3.0.6.
phpMyAdmin reports that I'm using MySQL with the following details:

MySQL:
  • Server: Localhost via UNIX socket

  • Server version: 5.5.52-0ubuntu0.12.04.1-log

  • Protocol version: 10

  • User: root@localhost

  • MySQL charset: UTF-8 Unicode (utf8)
Upgrading is not an option at this time.

It also reports these details about my web-server:
  • Apache

  • MySQL client version: 5.5.52

  • PHP extension: mysqli
The sql statement I'm using is:

Code:
$columnList = "first_name, last_name, CONCAT( TRIM( first_name ), ' ', TRIM( last_name ) ) AS 'first_last_name'";
$columnList = preg_replace( '/\s{2,}/', ' ', $columnList );   // Replace tabs, newlines, and multiple spaces with a single space.
$query = $this->db->select( $columnList )
                   ->from( 'events' )
                   ->join( 'users',   'events.user_id = users.id' )
                   ->join( 'artists', 'events.user_id = presenters.user_id' )
                  ->where( 'EXPORT_SET( eventStatus, "1", "0", "", 4 ) like "10_0"' )
                  ->where( 'LOCATE( CONCAT( " ", "' . searchTerm . '", " " ), ' .
                                   'UPPER( CONCAT( " ", TRIM( first_name ), " ", TRIM( last_name ), " " ) ) ) > 0' )
                    ->get()->result();

The intent of this query is to return information about events and presenters associated with the events in a results table shown on the same page where the user enters the searchTerm used above.  Additional query columns will be added at a later time.

This query is called by the client using Ajax, but instead of getting any results, the error call-back function is used and it shows:
 'Call to undefined function where()'.

Before coding the above statements, I created and successfully tested the SQL Select statement in the phpMyAdmin query tool.

I found an example using Google showing the usage pattern similar to that I'm using here in the where() function, i.e., an somewhat complex expression, but I don't know if this usage is valid.

So besides the where function issue, perhaps someone could please comment on how best to perform more complex where clauses that are beyond the basic where( "table.column_name", php_variable_name ).

Thanks,
Howard Brown
Reply


Messages In This Thread
I'm getting "Call to undefined function where()" - by howardb1 - 10-05-2016, 09:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB