嗨,每一个这只是我的第二篇文章,但我真的卡住了,并会感激任何帮助,提前表示非常感谢。我正在研究zencart将数据从数据库导出到2个csv文件,文件一个工作正常,但是当我运行文件2时我遇到了EOF循环问题,由于某种原因它会显示最后几个产品,如下所示dosent结束循环,
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的jon,这让我到目前为止:)
$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();
我真的欢迎任何人给出的任何建议或指导
非常感谢
罗素
答案 0 :(得分:1)
错字?
while(!$products_sock->EOF) {
^---missing a T?