-1

大家好,这只是我的第二篇文章,但我真的卡住了,希望能得到任何帮助,在此非常感谢。我正在处理 zencart 将数据从数据库导出到 2 个 csv 文件,文件 1 运行良好,但是当我运行文件 2 时,我遇到了 EOF 循环问题,由于某种原因,它会显示最后一个产品数千次,如下所示和结束循环,

ST,206,1,WIPAC 8" 4x4 100w Off-Road Driving Lamp Set Inc Grilles,0.0000,0
ST,387,0,Wolf Bench Grinder - WBG200/MD200F - Home - Tools - DIY,0.0000,0
ST,360,0,Wolfcraft TS 800 Adjustable Trolley - Home - Garden,0.0000,0
ST,116,0,WWE Ruthless Aggression 6 Pack - Wrestling Game - RARE - Retro,0.0000,0
ST,419,0,Zinc Ion XY Black Folding Scooter - Outdoors - Toy,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0

我正在使用的当前代码如下(感谢第 1 篇文章中的乔恩,他让我走到了这一步:)

$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    

while(!$products_stock->EOF) {
$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);
$products_stock->MoveNext();
}
$stimer = microtime_float();

我真的很欢迎任何人可以提供的任何建议或指导

非常感谢

罗素

4

1 回答 1

1

错字?

while(!$products_sock->EOF) {
                  ^---missing a T?
于 2013-03-08T21:15:09.227 回答