PHP: Invalid argument supplied for foreach() while dynamic data Export?

Getting error while Printing dynamic data in phpexcel – Error Invalid Argument while printing data from my MYSQL Database $labels = array(); $i = 0; while ($row1 = mysql_fetch_array($query_result1, …

Modify array during multiple foreach loop iterations

I’ve to update data for array which has 4 foreach loops, foreach ($dta[‘hotels’][‘hotels’] as $key => &$value) { foreach ($value[‘rooms’] as $key1 => $value1) { foreach …

HTML_TO_DOC() looping table from database

I was been in charge for a system that still using HTML_TO_DOC() with PHP. My question is, i want to display all data from database using table. Here is my coding example: $htmlContent=$html_2.’ &…

show an array values in nested FOR loop of str_replace where array values are part of replacement

I’m trying to replace these tags [mtgcard] cardname [/mtgcard] in a string, but while replacing I want also the cardname to be the part of an hyperlink (example below) Here is the function (found on …

Foreach loop returns only first index on multidimensional array PHP

Let me explain my situation, I’m making a mailing template for my company. This mailing template has to be completely in HTML. The mailing template contains different products from our shop. The …

How can I delete 1 row from a table using a submit button?

I am using a foreach loop to display my data. Im getting data from a table with reservations, which the customer is able to delete. This is my current code: if(isset($_POST[‘verwijder’])) { $resid= …

Get out of a foreach [closed]

My C++ teacher once told me that if I have to use a break to get out of a loop I didn’t think enough about the loop condition. So did she (very good teacher btw) just fail to mention that foreach …

return result of foreach loop(s)

I have the some code which looks something like this (I’ve simplified it): function process_something($a){ foreach($a as $b){ // Some logic here return $something; } } $input=[…

Magento get the SKU of the first simple product in configurable

I need to get the SKU for a simple product that is part of a configurable in Magento. Something along the lines of: if($_product is simple) { echo $_product->getSku(); } elseif($_product is …

TCPDF – loop data in two columns layout

Im using TCPDF, at the moment im a listing data in two columns using array_chunk which works fine. But i need data to be show in first columns and then second, see below: Currently: 1 2 …