I am working with MySQL in conjunction with ExpressionEngine 2.2.1. This version of ExpressionEngine automatically comes with a Query Module, which I am using to filter and display entry results from a module called Freeform. I am using Freeform version 3.1.1. All of these elements are working well together and displaying the desired results on my local setup. However when I push my code to production, I am receiving this error:
Fatal error: Call to a member function num_rows() on a non-object in /var/www/vhosts/xxxxxxxxx.com/systemxxx/expressionengine/modules/query/mod.query.php on line 183
Here is this section of the code beginning on line 183 of mod.query.php (I did not code this php, nor have I ever coded php, this was already included with the site that I am working on.):
183 if ($query->num_rows() == 0)
184 {
185 return $this->return_data = $this->EE->TMPL->no_results();
186 }
Here is how I am using the Query Module in my HTML Template:
{exp:query sql="SELECT first_name, last_name, email, city FROM exp_freeform_entries WHERE city = 'New York'"}
<tr>
<td>{first_name}</td>
<td>{last_name}</td>
<td>{email}</td>
<td>{city}</td>
</tr>
{/exp:query}
Does anyone know why this error is occurring? Why would it be occurring on production but not locally?
Any help would be greatly appreciated!
Check to make sure the database in Production has the same structure as your Local environment.
Perform the following steps from phpMyAdmin or your favorite MySQL GUI client:
DESCRIBE exp_freeform_fields;
SELECT name FROM exp_freeform_fields;
Compare the results from your Local MySQL Database to your Production MySQL Database.