Thanks for the help the final solution seems to be mysqli_fetch_all($result , MYSQLI_ASSOC) "is the type". I have not tested this fully yet but the print_r call seems fine.
I see why I was getting double arrays from the fetch and according to 3schools , wich I know to be wrong at times, fetch calls an associative array. Got to stop relying on 3schools to be correct and read the right manual.
I am begining to see this and what I am trying to do is insert a delimiter in the middle of the mysqli_fech_array($result) so I can split it between two sections of a page. ie: split the $result so it can be called like $result[0] and $result[1]. I am hesitant to sat it cannot be done , but see I am doing it the wrong way.
Is the fact that the $result is a multidimensional array causing this. I tested the base code from php.net and I am getting it to work.
$input_array = array('a', 'b', 'c', 'd', 'e');
print_r(array_chunk($input_array, 1));
print_r(array_chunk($input_array, 2, true));
Hi,
I am trying to split an array with array_chunk and having no luck.
I can call the array, display the array, but not as two or more just not working as I understand it .
I am pulling the array from MYSQL and have used count() to count arrays to debug this problem but get strange results.
mysqli_query returns a value of one as expected, and this is where things get strange as mysqli_fetch_array variable counts as two before I even change or try to chunk, and chunk always returns two and will echo the whole array not chunks $array[0] echos but $array[1] is null.
I am either trying to do something that cannot be done or my understanding is wrong. I have read the documentation over and over and anything else I could find with no luck.
Any help would be appreciated.
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.