emoncms / event_archived

Setup actions to occur when a feed goes above, below or is equal a set value. Set another feed or send an email
8 stars 25 forks source link

Fatal error: Call to a member function fetch_array() #26

Closed dazzag24 closed 10 years ago

dazzag24 commented 10 years ago

Fatal error: Call to a member function fetch_array() on a non-object in /var/www/emoncms/Modules/event/event_model.php on line 67

installed emoncms from github 2 days ago as per these instructions: http://emoncms.org/site/docs/installlinux

I am not running on a RaspberryPi.

I installed the event module just now and am getting the above error when I click on the new "events" link under extras. I have installed 2 other modules just now and they both seem fine.

dazzag24 commented 10 years ago

Looking at the code, I don't know why the SQL command failed, but it wouldn't it make sense to check that $result is valid before calling fetch_array() ?

public function eventlist($userid) { $list = array(); $result = $this->mysqli->query("SELECT * FROM event WHERE userid = '$userid'"); while ($row = $result->fetch_array()) { $list[] = $row; } return $list; }

mattiarossi commented 10 years ago

Did you run the database update (admin page-> Update & Check button) ?

dazzag24 commented 10 years ago

Erm, no, I didn't. Is this documented?

Actually now you come to mention it, where is the link to the admin page. I don't seem to have one.....

Bra1nK commented 10 years ago

Neither do I, I assumed it didn't exist in the more recent versions which use timestore

dazzag24 commented 10 years ago

Interesting.... I assumed that MySQL is still used behind the scenes for some data. I certainly have some feeds that are tagged as type MYSQL in the engine column (power_kwhd and power_histogram).

dazzag24 commented 10 years ago

I can see an "admin" directory under /var/www/emoncms

mattiarossi commented 10 years ago

Make sure you log in with the first user you created when installing emoncms, either that or set the flag admin to 1 in the users table (mysql) for the user you are using. Mysql is still used (as far as I know) for storing config and plugin data, for the feeds,inputs and dashboards related tables. Once you log in as an admin user you should see an additional option in the menu.

Bra1nK commented 10 years ago

I took the second option (setting admin flag to 1) and after logging out then in the 'Admin' menu option appeared. Thanks for the tip.

dazzag24 commented 10 years ago

I've only created one user. How come my admin page is missing?

How do I edit the MySQL table directly?

dazzag24 commented 10 years ago

Logged out and logged in again. I know see the admin link.

dazzag24 commented 10 years ago

Thanks. With the "Update & Check" button present I now seem to have the event module installed.