Forums

Error message when using a registration form

equiweb 31 Aug, 2010
I get this error message when a test new user registration using a form I created -
"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 ')' at line 1 SQL=INSERT INTO jos_users_visit VALUES ( 242 , 0 , 0, 0, ADDDATE("2010-08-31 15:16:38", 60),'','','','','','','','','',)"
Has anyone come across this and is there a fix?
GreyHead 31 Aug, 2010
Hi equiweb,

I suspect that the problem is the double quotes in ADDDATE("2010-08-31 15:16:38", 60) - try with single quotes instead ADDDATE('2010-08-31 15:16:38', 60)

Bob
nml375 31 Aug, 2010
Hi,
Actually, it's with the last "," at the end of the value-list; there's no value following it:

INSERT INTO jos_users_visit VALUES ( 242 , 0 , 0, 0, ADDDATE("2010-08-31 15:16:38", 60),'','','','','','','','','',)



MySQL can use either ' or " to delimit strings. You can even use both in a single query, as long as they're not intended to delimit the same string.

/Fredrik
GreyHead 01 Sep, 2010
HI Fredrik,

Yes, that makes sense. I was looking at the " right at the end and wondering if the whole string was wrapped in double quotes.

Bob
nml375 01 Sep, 2010
Hi,
They're easy to overlook. This though leaves the source for the improper query - as far as I can tell, #__users_visit belongs to the AUser plugin.
There seems to be a fix posted here: http://www.alikonweb.it/forum/1-auser-manager/1550-bugs-found-in-auser-manager-pack

/Fredrik

Edit: Actually, the "fixed" version seems to suffer from a bug capable of causing the above error:
$query = 'INSERT INTO #__users_visit VALUES ( '.(int) $result->id.' , 0 , 0, 0, ADDDATE("'.$now.'", '.$extend.'),'.$db->Quote($options['ip']).
  ','.$db->Quote($options['citta']).','.$db->Quote($options['stato']).
  ','.$db->Quote($options['countryname']).','.$db->Quote($options['latitude']).
  ','.$db->Quote($options['longitude']).','.$db->Quote($options['honey']).
  ','.$db->Quote($options['botscout']).','.$db->Quote($options['forumspam']).
  ','.$options['hscore'].')';

The last value lacks the $db->Quote() method, causing it to be inserted as an empty string rather than '' if there's no value for $options['hscore']. There are a few similar pieces of code within the plugin that also needs fixing.

That said, the Author really should consider using column-lists with their INSERT queries.
equiweb 01 Sep, 2010
Hi, thanks for the replies but I am not sure what I should be editing. I get the same message when I use the normal Joomla registration after removing the form I created with ChronoForms, so is it one of the Joomla files or is it the database table that needs editing?
Pete.
equiweb 01 Sep, 2010
Hi, I also do not have a jos_users_visit table in my database?
Pete.
nml375 01 Sep, 2010
Hi Pete,
The error is with one of your Joomla plugins/mambots - namely "AUser". If possible, see if the author has an updated/fixed version of the plugin - or if you really don't need it, disable/uninstall it.

/Fredrik
This topic is locked and no more replies can be posted.