Pulling records from another table.

15 posts by 3 authors in: Forums > CMS Builder
Last Post: October 25, 2010   (RSS)

Still getting the same message:
Notice: Undefined offset: 0 in /home/davgol20/goldcastleholdings.com/property.php on line 26

Goto this Suite page to see the Leasing Agent info (it works great)
http://173.236.177.72/suite.php?510-514-3

Go to this page where I want it to work but it won't:
http://173.236.177.72/property.php?name=Castle%20Building

Re: [chris] Pulling records from another table.

after adding the code you gave me now all I get is a white page with this message:

Agent not found!

Re: [chris] Pulling records from another table.

Forgot to add the "'allowSearch' => false, " now it's working perfectly.

Why would one page need that extra cose and the other doesn't? They are both trying to do the same thing so why would one work and not the other?

Re: [Dan Maitland] Pulling records from another table.

By Chris - October 25, 2010 - edited: October 25, 2010

Hi Dan,

It's because of your form input:

?name=Castle%20Building

Any getRecords() calls with "allowSearch" will automatically filter using form input that matches up with field names. allowSearch is enabled by default. Since your "agent" section has a "name" field, getRecords() is automatically adding an extra condition to your where clause to find only records which have name = "Castle Building".

It's probably good practice to disable allowSearch everywhere except in getRecords() calls where you explicitly want searching to occur.

Does that clear things up?
All the best,
Chris