antonioribeiro / tracker

Laravel Stats Tracker
MIT License
2.89k stars 596 forks source link

DB Error - select '1' as row from `tracker_sessions` #460

Open panadol007 opened 5 years ago

panadol007 commented 5 years ago

After following all steps in the installation instructions. Laravel Log shows: user_agent column not exists. After create the column with migration. Now it show another error.

In browser shows Alert error: laravel stats tracker DataTables warning: table id=table_div - Ajax error

Laravel Log show this error:

local.ERROR: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'row from `tracker_sessions` where `updated_at` >= ? and `updated_at` <= ?) AS co' at line 1 (SQL: select count(*) as aggregate from (select '1' as row from `tracker_sessions` where `updated_at` >= 2019-09-07 04:36:23 and `updated_at` <= 2019-09-08 04:36:23) AS count_row_table) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'row from `tracker_sessions` where `updated_at` >= ? and `updated_at` <= ?) AS co' at line 1 (SQL: select count(*) as aggregate from (select '1' as row from `tracker_sessions` where `updated_at` >= 2019-09-07 04:36:23 and `updated_at` <= 2019-09-08 04:36:23) AS count_row_table) at /home/markkhor/public_html/sms.360.my/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\\DBAL\\Driver\\PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'row from `tracker_sessions` where `updated_at` >= ? and `updated_at` <= ?) AS co' at line 1 at /home/markkhor/public_html/sms.360.my/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:63, PDOException(code: 42000): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'row from `tracker_sessions` where `updated_at` >= ? and `updated_at` <= ?) AS co' at line 1 at /home/markkhor/public_html/sms.360.my/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:61)
[stacktrace]
#0 /home/markkhor/public_html/sms.360.my/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select count(*)...', Array, Object(Closure))

I commented following line in /vendor/pragmarx/datatables/src/Bllim/Databases/Datatables.php: $countQuery->select(DB::raw("'1' as row"));

Now can access every page in 'stats', but only Visits & Page View Summary is working.

System

Additional context Add any other context about the problem here.

PHP version 7.2 Laravel version 5.8 MySQL version 8.0

sudinem commented 4 years ago

I hope reinstalling the package will work