Re: [Dave] Multi-select to display links and images
No matter what I change, I still get that MySql error
getRecords(products) MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Window, 3x4 Insulated Window, 4, 8, Extra Set of Doors, Framing Package - $1.75 ' at line 2
I have a section called "products" and it pulls a list from a section called "upgrades" by:
Section Tablename: Upgrades
Option Value: num
Option Label: upgrades
My Top of Page code is:
<?php
require_once "/home/lelands/public_html/webadmin/lib/viewer_functions.php";
list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$productsRecord = @$productsRecords[0]; // get first record
// get where
$recordNumbersArray = getListValues('products', 'a_upgrades', $productsRecord['a_upgrades']);
$recordNumbersAsCSV = join(', ', $recordNumbersArray);
if (!$recordNumbersAsCSV) { $recordNumbersAsCSV = "0"; } // prevent error from having empty string if no matches
// load all records
list($relatedProductRecords, $relatedProductsMetaData) = getRecords(array(
'tableName' => 'products',
'allowSearch' => '0',
'where' => "num IN ($recordNumbersAsCSV)",
));
?>
And my content code is:
<?php foreach ($relatedProductRecords as $record): ?>
Upgrades: <?php echo $record['upgrades'] ?>
Price: <?php echo $record['price'] ?>
<?php endforeach ?>
I have tried it many different ways, but this is what it is now.