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

By (Deleted User) - October 16, 2008

I pass some $_GET around in most of my url's to a control file(usually index.php at document root) that I run through a switch statement allowing me to set some variables needed for each page of the site.

When setting up the query array for the detail of a 'product' I see where you are calling a function where RecordNumberInUrl(1).

I have been tacking on the $record['num'] to a $_GET variable of my choice to the end of the url in calling the detail page and it has been working so far.

example: http://warther.org/index1.php?page=carvingsDetail&carving=2

My question is: what is the argument '1' that is being passed into the function?

It seems to work this way too and im not sure why:

How does it know to use $_GET['carving'] in the query?

What I am afraid of is that it will break if I continue to use this method. The client has access to continue to create records through the CMS.

Re: [seyrich] $_GET

By Dave - October 17, 2008

Hi Seyrich,

Sure no problem. For the second query it doesn't know how to use $_GET['carving'], there's no record number on the end of the url so it's just returning the first record it finds in the database.

Here's what whereRecordNumberInUrl(1) does:

If there's a number on the end of the url it returns: num = '$num'.

So in the case of this url: http://warther.org/index1.php?page=carvingsDetail&carving=2
These two would do the same thing:
'where' => whereRecordNumberInUrl(1),
'where' => " num = '2' ",

If there's no number on the end of the url it returns the value in the brackets. When that is 1 it just returns the first record found (any record).

So for this url: http://warther.org/index1.php?carving=2&page=carvingsDetail
These two would do the same thing:
'where' => whereRecordNumberInUrl(1),
'where' => " 1 ",

If you know you're always going to have the record number in $_GET['carving'] you could use that like this:

'where' => "num = '" .mysql_real_ecape_string(@$_GET['carving']). "'",

Hope that helps, let me know if you have any other questions about that.
Dave Edis - Senior Developer

Re: [Dave] $_GET

By (Deleted User) - October 17, 2008

Thank you. That is exactly what I needed to know. I can do so much more with this now.

The more I use this system the more and more I like it. I'm finding it very flexible and yet thorough compared to other systems I have attempted to use.


Re: [jposwald] $_GET

On a related note, how do I get CMS Builder to ignore the $_GET items. I am passing info that I don't want built into the WHERE clause.


Re: [dougdrury] $_GET

By ross - February 27, 2009

Hi Doug

To stop the $_GET[] from being used in the where clause, you can add:

'allowSearch' => '0',

to your list viewer code like this:

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'allowSearch' => '0',

Does that sound like it would work? Let me know :).
Ross Fairbairn - Consulting

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] $_GET

Perfecto! Thank you!!