Jump to content

return function loop prob


samoht

Recommended Posts

Hello,

 

New prob. I have a function that returns all the products with the same ItemId.

So I will usually have more than 1 row. The problem is I want to display the info from row one different than the rest.

basically after I display the first row of product info - I just want a list of the other product names below

 

like:

  <td colspan="2"><?php 
for($i=0; $i<$numPd;$i++)
{
extract($product[$i]);
 echo $Name ."<br />"; 
}?></td>

 

but it complains that my array is now empty?? maybe because I already extracted it for the first product?

(this code comes first in my page)

<?php
$product = getProductDetail($ItemId, $CPC);

// we have $pd_name, $pd_price, $pd_description, $pd_image, $cart_url
$numPd = count($product);
extract($product);
?> 
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr> 
  <td align="center"><img src="<?php echo $ImagelsURL; ?>" border="0" alt="<?php echo $Name; ?>"></td>
  <td valign="middle">
<strong><?php echo $Name; ?></strong><br>
Price : <?php echo displayAmount($PriceSell); ?><br>

 

any ideas what I am doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/70237-return-function-loop-prob/
Share on other sites

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.