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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.