SQL Error

5 posts by 3 authors in: Forums > CMS Builder
Last Post: March 27, 2009   (RSS)

By everbatim - March 25, 2009 - edited: March 25, 2009

I just started using CMS Builder, and it's working fine with most of my pages. However, a few areas of my site use additional PHP applications (aMember Subscription System, Trellis Helpdesk Sotware, etc.) and that seems to throw my systems though a loop. I'm getting the following error when i try to order a subscription through my aMember software. If I remove the references to the CMS Builder software, the site works fine, so I know its not aMember. THe best I can see it seems to be a conflict between the Trellis Desk and aMember and how they call their PHP database. ANY help would be greatly appreciated.
    MYSQL ERROR:
    Table 'C163167_ewcms.amember_error_log' doesn't exist
    in query:
    INSERT INTO amember_error_log (member_id, time, remote_addr, url, referrer, error) VALUES (NULL, NOW(), '98.117.203.91', '/login/member.php', 'http://eclipsewebinars.com/login/member.php', 'MYSQL ERROR:
    Table \'C163167_ewcms.amember_error_log\' doesn\'t exist
    in query:
    INSERT INTO amember_error_log\r\n (member_id, time, remote_addr, url, referrer, error)\r\n VALUES\r\n (NULL, NOW(), \'98.117.203.91\',\r\n \'/login/member.php\', \'http://eclipsewebinars.com/login/member.php\',\r\n \'WARNING: urlencode() expects parameter 1 to be string, array given\\nin line 409 of file /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php\')\r\n ')


    I also receive this error ABOVE my page layout in text format:



    WARNING: urlencode() expects parameter 1 to be string, array given in line 409 of file viewer_functions.php
    Notice: Undefined property: db_mysql::$debug_sql in /hsphere/local/home/c163167/eclipsewebinars.com/login/plugins/db/mysql/mysql.inc.php on line 3089 Strict Standards: Only variables should be assigned by reference in /hsphere/local/home/c163167/eclipsewebinars.com/login/common.inc.php on line 284 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 409 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 410 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 409 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 410 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 409 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 410 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 409 Warning: urlencode() expects parameter 1 to be string, array given in /hsphere/local/home/c163167/eclipsewebinars.com/cms/lib/viewer_functions.php on line 410



    Most of the lines in the error above are from aMember UNTIL you get to the "WARNING" message in the second to last line. Again, if I remove the CMS Builder scripts from the page, the error goes away and the site works fine (minus my content of course!).

    Thanks again!

    Re: [ross] SQL Error

    By everbatim - March 26, 2009

    Ross,

    Thanks for the assistance. Your right on in the fact that this is a "details" page. I keep my site very simple and as a result ALL of the content pages on my site are simple detail pages. What I ended up doing was making a duplicate of the "viewer_functions.php" file gave it a unique name. On all the pages that ONLY rely on CMS Builder to pull it's content, I reference the original file. On all the pages that interact with an additional PHP application to pull both content and database functions I reference the duplicate file. The only difference between the two files is that in the duplicate I removed the offending code, which were lines 409 and 410 in viewer_functions.php which were calling the URLENCODE issues you were speaking of. My basis on doing this was that since my site does not need to encode the URL's through CMS Bulder when it's combined with my third part PHP apps, there would be no need to even allow it to do so on those pages.

    So far everything is working OK. All the pages (both the ones using the original file and the duplicate file) are stable and are not throwing errors. I'm still in the development stages of the site, so I may infact find something that this doesn't "jive" with my adjustement.

    Can you think of any downsides to what I have done?

    Re: [everbatim] SQL Error

    By Dave - March 27, 2009

    Hi everbatim,

    I think that should be fine. But I'll update the code for the next version it development so it doesn't produce that error.

    I think it's happening when there are multiple form fields with the same name, like this: ?color[]=red&color[]=blue

    It's not meant to handle that. If you want to just add some code to skip those values (which CMS Builder shouldn't need) just search for urlencode and add the line in red:

    if (is_array($value)) { continue; }
    $extraQueryArgs .= urlencode($key) .'='. urlencode($value) . '&';
    $extraPathInfoArgs .= urlencode($key) .'-'. urlencode($value) . '/';


    Hope that helps!
    Dave Edis - Senior Developer
    interactivetools.com

    Re: [Dave] SQL Error

    By everbatim - March 27, 2009

    Yep, that did it too. I feel better running it like that instead of just randomly removing lines of code.

    Thanks again! :-)