Mam taki kod:
function stmt_bind_assoc (&$stmt, &$out) { $data = mysqli_stmt_result_metadata($stmt); $fields[0] = $stmt; $count = 1; while($field = mysqli_fetch_field($data)) { $fields[$count] = &$out[$field->name]; $count++; } call_user_func_array(mysqli_stmt_bind_result, $fields); } $mysqli = new mysqli("localhost", "root", "", "nlove"); if (mysqli_connect_errno()) { } if ($stmt = $mysqli->prepare($string)) { $stmt->execute(); //$stmt->bind_result($id, $login); stmt_bind_assoc($stmt, $cos2); while ($stmt->fetch()) { } return $cos2; $stmt->close(); } $mysqli->close()
Gdy próbuję wyświetlić nową, połączoną tablicę :
foreach ($cos2 as $element) { }
to dostaję tylko ostatni element tej poprzedniej... Co robię nie tak?