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: [everbatim] SQL Error

    By ross - March 26, 2009

    Hi there.

    Thanks for posting!

    Based on the error message, I am thinking it's coming from a detail page. What's happening is CMS Builder grabs a number out of the URL when you are on a detail page and brings up the appropriate article based on that. By default, the number is always the last thing in the URL.

    In this case though, it looks like your other scripts also put things in the URL and now the scripts have confused each other.

    If I am on the right track here so far, I think the solution is going to be hardcoding the link on your list pages that go to the detail page.

    By default, you are probably using $record['_link'] as the href part of your link tag. What you'll want to do is something like this:

    <a href="detailPageName.php?aMemberVariables&otherScriptVariables&<?php echo $record['num']; ?>

    What I've done there is made sure the CMS Builder record number is the last thing in the URL.

    Does that make sense? Does it sound like this might get things going? Give it a shot and let me know :).
    -----------------------------------------------------------
    Cheers,
    Ross Fairbairn - Consulting
    consulting@interactivetools.com

    Hire me! Save time by getting our experts to help with your project.
    Template changes, advanced features, full integration, whatever you
    need. Whether you need one hour or fifty, get it done fast with
    Priority Consulting: http://www.interactivetools.com/consulting/

    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) . '&amp;';
    $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! :-)