Clocky Problem ?! with MySql

When i use PData or file all is fine, but when i use MySql i get this error



[ERROR] addons/clocky/lua/meta.lua:136: attempt to perform arithmetic on field 'ClockyCurrentTime' (a nil value)
  1. GetClocky - addons/clocky/lua/meta.lua:136
   2. SendClocky - addons/clocky/lua/meta.lua:149
    3. fn - addons/clocky/lua/autorun/server/init.lua:229
     4. unknown - addons/ulib/lua/ulib/shared/hook.lua:183


Clocky.MenuCommand = "!clocky" --What to say in chat to open the menu?

Clocky.Save.Type 	= "file" --'PData', 'file' or 'both'
Clocky.Save.Folder 	= "clocky" --What folder in DATA to save to, if savetype is file
Clocky.Save.Autosave 	= false --Enable autosave?
Clocky.Save.Interval	= 300 --How often to autosave

Clocky.Admin.Enabled = false --Enable the admin menu?
Clocky.Admin.Ranks = {'admin', 'superadmin'} --What ranks can use the admin panel? These will not have access to config
Clocky.Admin.HighRanks = {'superadmin'} --These ranks will also have access to config

Clocky.SQL.Enabled 	= true --Change this to true to enable SQL, fill in the required stuff below if true!
Clocky.SQL.Module 	= "mysqloo" --Choose between "mysqloo" and "tmysql"
Clocky.SQL.Standalone 	= true --Do you want it to save only to MySQL or still use PData/file alongside MySQL?
Clocky.SQL.Servername 	= "TTT#1" --This is how Clocky will keep track of how long players have played on this specific server, for example 'TTT#1'

Clocky.SQL.Host 		= "127.0.0.1" --IP
Clocky.SQL.Port 		= 3306 --Port
Clocky.SQL.Database 	= "gmod_clocky" --Name of the database
Clocky.SQL.Username 	= "USER" --The username used to connect to the database
Clocky.SQL.Password 	= "PASSWORD" --Password of the above user
Clocky.SQL.Socket	= "" --Database socketing; leave blank unless you are not using default

Please make a Github issue in the future. Can you post what your database structure looks like? I submitted a pull request as a hacky fix for the value being nil, [del]but I have a hunch there’s a bigger issue with the table generation.[/del]

Is there a reason you left the username and password as the defaults?


-- MySQL dump 10.14  Distrib 5.5.33-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: gmod_clocky
-- ------------------------------------------------------
-- Server version	5.5.33-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `clocky_userinfo`
--

DROP TABLE IF EXISTS `clocky_userinfo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clocky_userinfo` (
  `steamid` text,
  `timeplayed` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `clocky_userinfo`
--

LOCK TABLES `clocky_userinfo` WRITE;
/*!40000 ALTER TABLE `clocky_userinfo` DISABLE KEYS */;
INSERT INTO `clocky_userinfo` VALUES ('STEAM_0:1:22009581','~\"TTT#1v\":n0;'),('STEAM_0:0:53880449','~\"TTT#1v\":n0;'),('STEAM_0:1:49125626','~\"TTT#1v\":n0;'),('STEAM_0:0:82580991','~\"TTT#1v\":n0;'),('STEAM_0:1:61355079','~\"TTT#1v\":n0;'),('STEAM_0:1:52982197','~\"TTT#1v\":n0;'),('STEAM_0:0:8945482','~\"TTT#1v\":n0;');
/*!40000 ALTER TABLE `clocky_userinfo` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping events for database 'gmod_clocky'
--

--
-- Dumping routines for database 'gmod_clocky'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2014-09-28 13:25:42


Thats a backup of the Database.

And i remove the Username and the Password, because u dont have to know that.

Are you sure that it’s actually connecting to the database?


INSERT INTO `clocky_userinfo` VALUES ('STEAM_0:1:22009581','~\"TTT#1v\":n0;'),('STEAM_0:0:53880449','~\"TTT#1v\":n0;'),('STEAM_0:1:49125626','~\"TTT#1v\":n0;'),('STEAM_0:0:82580991','~\"TTT#1v\":n0;'),('STEAM_0:1:61355079','~\"TTT#1v\":n0;'),('STEAM_0:1:52982197','~\"TTT#1v\":n0;'),('STEAM_0:0:8945482','~\"TTT#1v\":n0;')


u see that the MySQL Database has values ?
So yes it did o.O

Sorry, couldn’t exactly see that on my phone. Once he merges my PR, see if that fixes your issue.

Ok lets wait for an answer

[editline]28th September 2014[/editline]

I have add an Issue on GitHub -> https://github.com/Jake-TD/Clocky/issues/7

And ? Did he answer ?

His pull requests are still uncommited.

What you can do though, is fork Clocky and pull the changes code_gs made into your fork.

Read here how to do that.