While Loop Loading Correlating Records Issue

3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 4, 2011   (RSS)

By Steve99 - January 4, 2011

Intent: To pull correlating records based on selected features

Description: The Cell Phones section editor uses a multi checkbox list to select feature options from the Features section editor (table). Instead of simply listing them out by using the CMS join with getListLabels function, my desire is to add a link for a pop up window to each item to display the Feature description content. The pop up window is set to pull the record from the number in the URL.

Issue: The 'where' condition should be set to pull the record based on the variable passed, however it is kicking back an error stating 'Unknown column VAR in where clause'. Seems to be a problem with looking up the VAR in the specified column because the error is stating the VAR as the unknown column.

Here is the code:
<?php $start_values = join(',', getListLabels('cell_phones', 'services_features', $cell_phonesRecord['services_features']));
$valuesArray = explode( ",", $start_values );
$valuesCount = count($valuesArray);
$i = 0;
while ($i < $valuesCount) {
// CORRELATING SERVICE FEATURE load records
$service_feature = mysql_real_escape_string($valuesArray[$i]);
list($servicesRecordsSF, $servicesMetaDataSF) = getRecords(array(
'tableName' => 'services',
'where' => 'title = '.$service_feature,
));

foreach ($servicesRecordsSF as $record) {
print "<ul>";
print "<li class=\"service_feature_popup_link cursor\" onclick=\"MM_openBrWindow('service-feature-popup.php?".$record['num']."','Features','toolbar=yes,location=yes,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=400')\">".$record['title']."</li>";
print "</ul>";
}
$i++;
}
?>


Any help would be appreciated. Thank you in advance.

Re: [Jason] While Loop Loading Correlating Records Issue

By Steve99 - January 4, 2011

You are absolutely correct. Thank you!