Quote Originally Posted by jc8125 View Post
Firstly, when you're outputting your results - you're not looping through the results.. you'd probably want the output inside of something like:
Code:
while (!$products_stock->EOF){
//do something for each product returned
$products_stock->MoveNext();
}
But more importantly - have you looked at the free easy populate plugin? It basically does what you're attempting to do, and it's already written.. :) You can add fields to it if needed, but it seems like you're re-inventing the wheel (unless i'm missing something). If this is for an import into another program, you might find it easier to manipulate the order of the fields/file that easy populate creates, instead of starting from scratch (just my 2¢)
Hi, many thanks for your reply, i thought the same and add EOF, now when i run the last product is looping and like this


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
ST,220,0,Zoobles Mama & Zoobling Trinka and Tito & Tonia #306 Play Set,0.0000,0

the last product loops thousands of times,

Any idea how to stop the loop when the last product has been displayed, i have tried

for($i=0;$i<$products_stock->rowCount();$i++) {
$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();
}

but it white screens, i really appreciate any help

Thank you

Russell