Developer Error Log

11 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: July 2, 2018   (RSS)

By gversion - June 27, 2018

Hello,

I am seeing the following error message on my user registration page:

E_USER_NOTICE: MySQL Error: Incorrect integer value: '' for column 'maxRecords' at row 1
- in register.php on line 79 by mysql_insert()
/opt/apache2/htdocs/cmsb/lib/common.php (line 1246)

I see that maxRecords is set as follows:

mysql_insert('_accesslist', array(
'userNum' => $userNum,
'tableName' => '_listings', // insert tablename you want to grant access to, or 'all' for all sections
'accessLevel' => '6', // access level allowed: 0=none, 6=author, 9=editor
'maxRecords' => '', // max listings allowed (leave blank for unlimited)
'randomSaveId' => '123456789', // ignore - for internal use
));


Can I change the blank value to something else to fix this error (e.g. NULL)? Any advice would be appreciated. I'd like to tick this error off from the log!

Thanks,

Greg

By gversion - June 27, 2018

Thanks, Leo - sounds simple enough. Are you sure that won't stop users posting any listings at all?!

Regards,

Greg

By leo - June 27, 2018

Hi Greg,

Sorry I didn't realize it's generated by the website membership plugin. In that case, can you try setting it to be null?

Let me know if it works.

Thanks,

Leo - PHP Programmer (in training)
interactivetools.com

By gversion - June 28, 2018

Hi Leo,

I tried setting it as follows:

'maxRecords'   => NULL, 

But this resulted in an error:

MySQL Error: Incorrect integer value: '' for column 'maxRecords' at row 1 - in register.php on line 79 by mysql_insert()

Thanks,

Greg

By leo - June 28, 2018 - edited: June 28, 2018

Hi Greg,

Can you try Changing the mysql_insert to:

mysql_insert('_accesslist', array(
 ...
 'maxRecords' => '',
 ...
), true);

Let me know if you are still getting errors!

Leo - PHP Programmer (in training)
interactivetools.com

By gversion - June 28, 2018

Hi Leo,

Just checking - should maxRecord in your last message be singular?

What does the "true" value do?

Thanks,

Greg

By leo - June 28, 2018

Hi Greg,

No it's a typo. It should be maxRecords.

The "true" disables sql strict mode temporarily so that integer fields takes empty value as valid input.

Leo - PHP Programmer (in training)
interactivetools.com

By gversion - June 28, 2018

Hi Leo,

Thank you very much for the help - that seems to have stopped the error messages.

Is this just a temporary fix? Can it be resolved without this workaround? Does this introduce any potential security concerns?

Thanks again for the support.

Regards,

Greg

By leo - June 29, 2018

Hi Greg,

It's not a temporary fix, you have some other options to resolve it but this is the best and fastest way to solve it. There are no significant security concerns as far as I know. To know more about sql strict mode you can check it here: https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sql-mode-strict

Thanks,

Leo - PHP Programmer (in training)
interactivetools.com