I have a array and i use two foreach but I be only able to print the first foreach.
$test = $db->query("SELECT * FROM Test"); foreach ($test as $readTest) { echo $readTest["col1"]; } foreach ($test as $readTest) { echo $readTest["col2"]; } and I try with this:
$test1 = $test; $test2 = $test; I expect the output of $readTest["col1"] and $readTest["col2"], but the actual output is $readTest["col1"]
Test? 2) what doesecho '<pre>'. print_r($test, 1) .'</pre>' output?3) why are you looping the same thing twice.. why not one foreach loop echoing the values? At the moment they both start at 1, loop through then start again. Much more efficient to use one loop.