Linking Data to a summary page

13 posts by 3 authors in: Forums > CMS Builder
Last Post: October 27, 2011   (RSS)

Re: [degreesnorth] Linking Data to a summary page

By Jason - October 27, 2011

Hi,

You already have code on your page to retrieve a record from country_intros. If you are getting an "undefined index" error, chances are you're query isn't returning anything.

You can confirm this with this piece of code:

$tourIntroRecord = @$tourIntroRecords[0]; // get first record


showme($tourIntroRecord);
die("DEBUG ENDS");


If all you get back is "DEBUG ENDS" or Array() DEBUG ENDS, then the query to retrieve a record wasn't successful.

It looks like the field country_name is a text field, or a single value list field. If this is the case, adding tab (\t) characters around your search value wouldn't work.

Try this:

// determine if a country was selected for searching
$tourIntroWhere = @$_REQUEST['country_list_keyword']
? "country_name = '". mysql_real_escape_string( @$_REQUEST['country_list_keyword'] ) ."'"
: "title = 'Generic'";


Let me know if this works for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By degreesnorth - October 27, 2011

Hi Jason

Yes, adding that seemed to have worked. I ended up getting a long list of Array( [_filename] => Egypt [_link] => javascript:alert('Set Detail Page Url for this section in: Admin > Section Editors > Viewer Urls') [accommodation] => [country_intro_copy] => Egypt has one of the oldest and most diverse cultural histories in the world and we love it. From the awe-inspiring temples of the Pharaohs to the architectural wonders of the Islamic period, a visit to this country is a fascinating journey through 5000 years of history. Along the way you'll encounter Greeks, Romans, Byzantines, Fatimids, Mamluks and Ottomans - to name but a few. Together with the bountiful Nile Valley, there's also some outstanding desert scenery - and a side-trip to Alexandria is a must. [country_name] => Egypt [country_name:labels] => Array etc, etc... then took the small piece of code out, and then it works.Thanks for that.  I don't understand it, but it works so am happy :)!Cheers