A Few CMSB Errors
4 posts by 2 authors in: Forums > CMS Builder
Last Post: October 3, 2013 (RSS)
By Perchpole - October 2, 2013
Hello, All
I've noticed a couple of errors creeping into the cmsb code. The first 2 were revealed when I created a new Single Record editor. Whenever I try to save my changes the following errors appear:
Notice: Undefined index: _listPage in /path/cmsb/lib/menus/database/editTable_functions.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /path/cmsb/lib/menus/database/editTable_functions.php:218) in /path/cmsb/lib/menus/header.php on line 2
Another completely unconnected issue concerns mysql_get. I often use a piece of code like this:
$thisCategory = mysql_get('category',$record['recordCategory']);
However, this has started causing an error:
mysql_get: second argument must be numeric or null, not ' 5 '!
As you can see, there are spaces around the number. In order to get it to work you have to add a trim function:
$thisCategory = mysql_get('category',trim($record['recordCategory']));
It never used to be like this.
:0(
Perch
Hi Perch,
Could you post or attach your code that is causing the first error for me?
The second error is most likely happening because the $record['recordCategory'] doesn't contain a numeric value. What happens if you use the showme function to display the recordCategory contents?
showme($record['recordCategory']);
Thanks!
Greg
PHP Programmer - interactivetools.com
By Perchpole - October 3, 2013
Hi, Greg -
The $record['recordCategory'] does contain a numeric value - but the spaces around it are turning it into a string.
When I run:
showme($record['recordCategory']);
It shows this in the code:
<xmp> 5 </xmp>
:0/
Perch
If the result is tab separated, I guess you're using a multi item select list field? Could the issue be that some items have more than one category selected, so the trim value ends up being something like this:
<xmp>5 6</xmp>
This would also explain why it sometimes works, as items with one item checked would trim down to a numeric value.
Cheers
Greg
PHP Programmer - interactivetools.com