Hello Zen Forum,
Im fairly new to the forum but hope someone can give me a hand im struggling..
my code is below, i am exporting to a csv file from the zen cart database
$products_cost =
"select p.products_id, pd.products_name, p.products_quantity, ".
"p.products_cost, (p.products_quantity*p.products_cost) AS products_total_cost, ".
"p.products_type ".
"from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd ".
"where p.products_id = pd.products_id and pd.language_id='" . $_SESSION['languages_id'] . "' ".
"order by (p.products_cost) DESC, p.products_cost desc, pd.products_name";
$products_stock = $db->Execute($products_cost);
//Start Of Output for Stock File
$output = array();
$output["tx_type"]='ST';
$output["Stock_Code"]= $products_stock->fields['products_id'];
$output["Qty"]= $products_stock->fields['products_quantity'];
$output["Description"]= $products_stock->fields['products_name'];
$output["CostPriceEx"]= $products_stock->fields['products_cost'];
$output["TotalCostEx"]= $products_stock->fields['products_cost'] * $products_stock->fields['products_quantity'];
zen_sages_fwrite($output);
$stimer = microtime_float();
When running the code i get an output like below, but instead of showing each product from the database it is showing the same one ??
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
ST,1149,10,350gsm A6 Glossy Postcards,290.0000,2900
I have tried adding $products_stock->MoveNext();
But dosent seam to have any affect,
Thanking you all in advance
Russell


Reply With Quote

