So here’s the line with the SQL query in it. How do I use strftime(‘%s’, ‘now’) without python trying to replace %s with a string… this is incredibly annoying.
Thanks
DBQuery.query('INSERT INTO test (Date, Entry) VALUES (strftime(''%ss'', ''now''), "%s")' %('%', cherrypy.request.params['username']), 'INSERT')
You can just escape the
%by using two back to back, so put%%sin the string where you want it to become%s. For example:Also, I don’t think your back to back single quotes are doing what you think they are. This will not leave a single quote in the string, it will just concatenate the two strings together, for example:
Instead you should use triple quoted strings or escape the single quote. End result might look something like this: