MyBB Community Forums

Full Version: Registration using SQLite fails
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When trying to register, I get the following error after clicking on the "I Agree" button:

SQL Error: -
Query: SQLSTATE[HY000]: General error: 1 no such function: RAND

SQLite version is 3.7.7.1

Rick
It will be fixed in MyBB 1.8.1, in meanwhile you can apply the changes from here: https://github.com/mybb/mybb/commit/5ece...cb4e0feabd

Also, make sure the conditional is actually:
if($db->type == 'pgsql' || $db->type == 'sqlite')
as per ArouG's comment.
Hello !!

Sorry Destroy666 ... just a little clarification :

1 - my topic, on this forum, is here : http://community.mybb.com/thread-159906.html
2 - and my fix is in the topic : update the inc/functions_user.php

You talk about a version (1.8.1 ?? not here) and about a futur patch not here too Wink

the fastest solution is to make the changes as :

********before :
function generate_question()
{
global $db;

$query = $db->query("
SELECT qid, shown
FROM ".TABLE_PREFIX."questions
WHERE active='1'
ORDER BY RAN()
LIMIT 1
");

********after :
function generate_question()
{
global $db;

$query = $db->query("
SELECT qid, shown
FROM ".TABLE_PREFIX."questions
WHERE active='1'
ORDER BY RANDOM() <---- (RAND becomes RANDOM)
LIMIT 1
");


2 characteres to be added : 'OM'
Ummm? As I said, he needs to apply the fix mentioned by me manually, of course, and it's better than just adding 'OM' if the OP decides to switch to MySQL someday.
Thanks for the quick fix! Smile