PHP Array - some further problems with displaying elements in the array
Posted
by Homer_J
on Stack Overflow
See other posts from Stack Overflow
or by Homer_J
Published on 2010-04-23T18:21:05Z
Indexed on
2010/04/23
18:23 UTC
Read the original article
Hit count: 169
php
Hi again,
Thanks in advance for the help.
Here is my array based on $rowq
:
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 ) )
I would like to display elements of the array using (i think) the foreach
statement but I can't get it working, ideally, I would like to echo something like this
echo "<tr>".$rowq[qnum]." is the questions number and the question text is ".$rowq[qtext].". The page and q values are ".$rowq[page]." and ".$rowq[questions]." respectively.";
And that link of text would appear how however many rows the array has in it.
Any and all advice appreciated - I'm struggling like heck to get my head around multi-dimensional arrays :(
Homer.
© Stack Overflow or respective owner