Herkese teşekkürler, soru cevap! Herkes ilgi ise aşağıdaki gibi güncellenmiş fonksiyonu diğer tüm kodu aynı kalır, bir:
function fetch_questions($page) {
global $link;
$proc = mysqli_prepare($link, "SELECT * FROM tquestions_cwh 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);
// $rows[]=$rowq;
// }
while ($proc->fetch())
{
foreach($rowq as $key=>$value )
{
$row_tmb[ $key ] = $value;
}
$rows[] = $row_tmb;
}
mysqli_stmt_close($proc);
mysqli_clean_connection($link);
return($rows);
}
Tamam,
İşte kod:
function fetch_questions($page) {
global $link;
$proc = mysqli_prepare($link, "SELECT * FROM tquestions_cwh WHERE page = ?");
mysqli_stmt_bind_param($proc, "i", $page);
mysqli_stmt_execute($proc);
$rows = array();
stmt_bind_assoc($proc, $rowq);
// loop through all result rows
while ($proc->fetch()) {
// print_r($rowq);
$rows[]=$rowq;
}
mysqli_stmt_close($proc);
mysqli_clean_connection($link);
return($rows);
}
Ben o zaman gibi bir php değişken bunu ekleyin:
$qs = fetch_questions($page);
Yoluyla Sonra döngü şöyle olduğunu:
foreach($qs as $value){
echo "<tr>".$value['qnum']." is the questions number and the question text is ".$value['qtext'].". The page and q values are ".$value['page']." and ".$value['questions']." respectively.</tr>";
Çıktı, ancak şudur:
8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.8 is the questions number and the question text is I know how what I do fits into my team's objectives. The page and q values are 1 and q8 respectively.
Ne istediğiniz değil, hangi bilgi amaçlı, yazdırma işlevini kullanarak bu dizi gibi görünüyor:
Array
(
[0] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[1] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[2] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[3] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[4] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[5] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[6] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
[7] => Array
(
[questions] => q8
[qnum] => 8
[qtext] => I know how what I do fits into my team's objectives
[page] => 1
)
)
Açıkçası bu döngü ve olması gerektiği gibi her satır görüntüleniyor değil ... herhangi bir tavsiye?
Homer.