Confused as to why I am getting this message
Warning: implode(): Invalid arguments passed
Here is my script
$out = "";
while($row = $results->fetch_array()) {
// do stuff here to create an indexed array
$arraycount = count($array);
for ($i=0; $i < $arraycount; $i++) {
foreach($array as $arr) {
$out .= implode(";", $arr) . "<br>";
}
}
}
I know $array is a proper indexed array.. if I do this before or after my for/foreach loop:
echo '<pre>';
print_r($array);
echo '</pre>';
The output is all my arrays
Array
(
[0] => Array 1 Node 1
[1] => Array 1 Node 2
[2] => Array 1 Node 3
[3] => Array 1 Node 4
[4] => Array 1 Node 5
)
Array
(
[0] => Array 2 Node 1
[1] => Array 2 Node 2
[2] => Array 2 Node 3
[3] => Array 2 Node 4
[4] => Array 2 Node 5
)
Array
(
[0] => Array 3 Node 1
[1] => Array 3 Node 2
[2] => Array 3 Node 3
[3] => Array 3 Node 4
[4] => Array 3 Node 5
)
etc. etc. etc.
The output I'm looking to get out of all of this, if you can't tell by the loop, is a csv-like file with a ; delimiter.
This loop works fine outside of the loop, but then I'm having the issue of it not retrieving all the results from each loop-- so doing it within the loop as I am attempting I believe is ideal.
Anyone know what I'm doing wrong/why this isn't working in the while loop?
implode(";", $arr)-- Is$arran array?implode()expects the second argument to be an array.