Jump to content

Search the Community

Showing results for tags 'foreach issue'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have a shopping cart that sends an email once an item is purchased. When an item is added to the shopping cart, if it's a custom item it fills in information into the custom_image if its an custom image item if not it's left blank. All items fill in a custom_product field as well when added to the cart. When I process this script and only have a custom item proccessed or custom product it works perfect. I have the email send an image of the custom images created by the user that's stored in the cart under custom_image. Other products store custom_product information as well. if I have any custom_image product in my cart, it echos that custom image for every product in the cart when processed. If i only have one or the other in the cart it works perfect. From my code I thought if I had a foreach value it would go line by line every time it processed and item and did a check if Image_custom is empty or not. If it's empty then just do the ELSE but it's bleeding over. Any help would be greatly appreciated foreach ($this->get_cart() as $value) { $myurl = "http://www.myurl.com/scripts/"; if (!empty($row['custom_image_10'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> <br>' . $row['custom_product'] . 'x -<a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_6'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_7'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_8'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_8'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_8'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_9'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_9'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_9'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_10'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_10'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_10'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_9'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> <br>' . $row['custom_product'] . 'x -<a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_6'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_7'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_8'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_8'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_8'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_9'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_9'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_9'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_8'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_produc'] . 'x -<a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_6'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_7'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_8'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_8'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_8'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_7'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_6'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_7'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_7'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_7'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_6'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_6'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_6'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_6'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_5'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_5'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_5'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_5'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_4'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_4'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_4'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_4'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_3'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_3'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_3'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_3'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image_2'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . '.jpg\" width=\"150\" height=\"100\"></a><br>' . $row['custom_product_2'] . 'x - <a href=\"' . $myurl . '' . $row['custom_image_2'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image_2'] . ".jpg\" width=\"150\" height=\"100\"></a>"; } elseif (!empty($row['custom_image'])) { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . 'x -<a href=\"' . $myurl . '' . $row['custom_image'] . '.jpg\"><img src=\"' . $myurl . '' . $row['custom_image'] . ".jpg\" width=\"150\" height=\"100\"></a><br>"; } else { $products .= $value['product_quantity'] . ' x ' . $value['product_name'] . ' (' . price($value['product_price']) . ') = ' . price($value['total_price']) . ' <br /> ' . $row['custom_product'] . ' ' . $row['custom_product_2'] . ' ' . $row['custom_product_3'] . ' ' . $row['custom_product_4'] . ' ' . $row['custom_product_5'] . ' ' . $row['custom_product_6'] . ' ' . $row['custom_product_7'] . ' ' . $row['custom_product_8'] . ' ' . $row['custom_product_9'] . ' ' . $row['custom_product_10'] . "<br><br>"; }
×
×
  • 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.