SQL Error

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

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: [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) . '&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! :-)