Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.1k views
in Q2A Core by
I've linked Q2A to an external user database using the methods in the advanced install instructions. User login is recognized. However, whenever I try to post a question, I get this error:

Question2Answer query failed:

INSERT INTO qa_posts (categoryid, type, parentid, userid, cookieid, createip, title, content, tags, notify, created) VALUES (NULL, _utf8 'A', 1, _utf8 '2', NULL, INET_ATON(_utf8 '61.51.76.176'), NULL, _utf8 'this is a test', NULL, NULL, NOW())

Error 1364: Field 'acount' doesn't have a default value
by
Henry,
Can you please post your qa-external-users.php file here.I need some information.

1 Answer

0 votes
by
This is happening because your MySQL installation is using something called 'strict mode' which insists on every column either being set when a row is created, or having an explicit default value.

This is clearly a problem and I'll change the release of version 1.2 of Q2A so that it is compatible with strict mode. In the meantime, you can change the database schema (via ALTER TABLE) to explicitly set a default of 0 (zero) for the acount column, or else change your configuration to switch 'strict mode' off.

It's quite possible this will affect some other queries too.
by
I might add that when I set external-users to false and installed qa's own user tables, posting works just fine.

I changed the database schema via ALTER TABLE and the default value is 0. However, the same error occurs. I'm going to fiddle around with function qa_db_post_create in qa-db-post-create.php and see what happens.
by
OK, thanks. It looks like I was wrong about the cause, so please let me know what you find!
by
@Henry. I've successfully done a new install with WordPress 3.0 and Q2A1.2 beta. However, I had loads of problems using FireFox, but it works fine in MSIE. I can only guess at the moment that it is something to do with the way Firefox is handling sessions or cookies. I'll investigate further and try to find out exactly what is happening.

I have two existing installations on a different server that work with Q2A1.1 OK. One is Wordpress 2.9 and the other 3.0. I'll upgrade one of those to 1.2 beta and report back.

At the moment I'm thinking it is either a server issue, or a Firefox issue, with my money on it being a server issue.
by
edited by
I can confirm that every combination of Q2A version, WordPress version, and browser work fine on a JustHost server. There is a problem with FireFox on a BlueHost server with both the latest production release and the 1.2beta Q2A, though it does work with MSIE.

I'll see what BlueHost have to say.

[Later  - BlueHost are no help. Also, I've changed my mind on JustHost - technically they are OK, but their shared hosting scheme is not suitable for much more than a couple of hundred users, and they don't do dedicated. So far so good with DreamHost (and with NativeSpace in the UK).]
by
@gidgreen, ok scratch what I said, it appears that setting all the default values for any of the *count variables to 0 does get it to work. Reason this happened to me was because I was using the WP-United plugin with wordpress which accesses wp_users as well.
...