Katkılarından dolayı teşekkür ederiz şimdiye kadar - Ben $ rowq tek bir dizi ancak bunlardan çok değil şimdi görebiliyorum - Ben herhangi bir öneri, geri dizideki tüm satırları getirmek istiyorum?
Öncelikle, bir diziye benim verileri geri getirir kodu:
function fetch_questions($page) {
global $link;
$proc = mysqli_prepare($link, "SELECT * FROM tques WHERE page = ?");
mysqli_stmt_bind_param($proc, "i", $page);
mysqli_stmt_execute($proc);
$rowq = array();
stmt_bind_assoc($proc, $rowq);
// loop through all result rows
while ($proc->fetch()) {
// print_r($rowq);
}
mysqli_stmt_close($proc);
mysqli_clean_connection($link);
return($rowq);
}
Şimdi, ne zaman `print_r ($ rowq); ' Ben tüm iyi olduğu, aşağıdaki olsun:
Array ( [questions] => q1 [qnum] => 1 [qtext] => I find my job meaningful [page] => 1 ) Array ( [questions] => q2 [qnum] => 2 [qtext] => I find my job interesting [page] => 1 ) Array ( [questions] => q3 [qnum] => 3 [qtext] => My work supports ABC's objective [page] => 1 ) Array ( [questions] => q4 [qnum] => 4 [qtext] => I am able to balance my work and home life [page] => 1 ) Array ( [questions] => q5 [qnum] => 5 [qtext] => I am clear about what is expected of me in my job [page] => 1 ) Array ( [questions] => q6 [qnum] => 6 [qtext] => My induction helped me to settle into my job [page] => 1 ) Array ( [questions] => q7 [qnum] => 7 [qtext] => I understand the ABC vision [page] => 1 ) Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 )
Şimdi, benim php sayfasında ben script aşağıdaki parça var:
$questions = fetch_questions($page);
Ve ben aşağıdaki gibi, $ soruları print_r zaman:
print_r($questions);
Ben sadece dizi, 1 satır geri şu olsun:
Array ( [questions] => q8 [qnum] => 8 [qtext] => I know how what I do fits into my team's objectives [page] => 1 )
Bu yüzden herhangi bir fikir olabilir?
Teşekkür peşin,
Homer.