Thanks for the quick response.
So, forget about the multiple modules. I've attached code for a block below. As it is, it works. If I move $bfp out of the function, and uncomment the global $bfp it doesn't. I'm sure I'm doing something obvious and dumb, but I think that should work.
Of course, I've been programming in PHP for only a few weeks, so my opinion doesn't count for much
![](https://xoops.org/uploads/smil3dbd4d6422f04.gif)
I I cut and paste the code into my admin/index.php, it seems to work there. Is there something different about the execution environment of blocks?
Thanks,
Tom
-----------------------------------
// Gets the value as a string. If the value is an array, it concatenates the elements, separated by commas
function bookstore_get_value($v)
{
if (!is_array($v))
return $v;
$str = "";
$first = true;
foreach($v as $i)
{
if (!$first)
$str .= ", ";
$str .= $i;
$first = false;
}
return $str;
}
function b_bookstore_show()
{
global $xoopsDB;
// global $bfp;
$bfp = array("ProductName", "SalesRank", "Asin", "Url", "ImageUrlMedium", "Authors", "ReleaseDate", "Catalog", "OurPrice", "Manufacturer");
$block = array();
$queryString = 'SELECT ' . bookstore_get_value($bfp) . ' FROM ' . $xoopsDB->prefix('bookstore_product') . " ORDER BY $bfp[0] ASC";
$result = $xoopsDB->query($queryString);
while ($values = $xoopsDB->fetchRow($result))
{
$link = array();
for ($i = 0; $i < count($bfp); $i++)
{
$link[$bfp[$i]] = $values[$i];
}
$block['links'][] = $link;
}
return $block;
}
?>