Jump to content

How to pull value from sql table and ad it to a path?


ghurty

Recommended Posts

I have the following code to help generate a list of "vendors". I am trying to ad on though that it should also have the "vendors" logo. The path for the logo is /product_images/vendor_images/*_logo.png

The * is the 'vendorid' number from the sql table. How do I tell it to pull up the vendor id# like it is pulling it up for the rest of the script, and insert into the *_logo.png.

 

Thanks

 

 

$GLOBALS['VendorLogo'] =  /product_images/vendor_images/???????????

 

public function SetPanelSettings()
{
	$GLOBALS['SNIPPETS']['VendorList'] = '';
	$query = "
		SELECT *
		FROM [|PREFIX|]vendors
		ORDER BY vendorname DESC
	";
	$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
	while($vendor = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
		$GLOBALS['VendorId'] = $vendor['vendorid'];
		$GLOBALS['VendorName'] = isc_html_escape($vendor['vendorname']);
		$GLOBALS['VendorLink'] = VendorLink($vendor);
		$GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor);
		$GLOBALS['SNIPPETS']['VendorList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('VendorListItem');
		$GLOBALS['VendorLogo'] =  /product_images/vendor_images/???????????
	}

Don't know if I understood your question, but try this:

 

public function SetPanelSettings()
{
$GLOBALS['SNIPPETS']['VendorList'] = '';
$query = "
		SELECT *
		FROM [|PREFIX|]vendors
		ORDER BY vendorname DESC
";

$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

while($vendor = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
	$GLOBALS['VendorId'] = $vendor['vendorid'];
	$GLOBALS['VendorName'] = isc_html_escape($vendor['vendorname']);
	$GLOBALS['VendorLink'] = VendorLink($vendor);
	$GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor);
	$GLOBALS['SNIPPETS']['VendorList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('VendorListItem');
	$GLOBALS['VendorLogo'] =  "/product_images/vendor_images/". $vendor['vendorid'] ."_logo.png";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.