PHP Array - Dizideki elemanları görüntüleme ile bazı başka sorunlar

1 Cevap

Aşağıda Brian'ın öneri kullanma:

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>";
        }

Ben doğru değil diziden aşağıdaki çıktıyı almak:

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

Herhangi bir başka öneri.

Homer.

Merhaba tekrar,

Yardımlarınız için şimdiden teşekkür ederiz.

İşte dayanarak benim dizisi $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 think) foreach deyimi kullanarak her satır döngü, dizinin öğeleri görüntülemek istiyorum ama bu ideal, çalışma almak değil, ben böyle bir şey yankı istiyorum

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.";

Ve metnin bu bağlantı dizi içinde olan ancak birçok satır görünür.

Her türlü tavsiye takdir - Ben çok boyutlu diziler etrafında başımı almak için halt gibi mücadele ediyorum: (

Homer.

1 Cevap

Trilli gelen değişiklikler

Bunu asla kullanma bu yana 1) $ anahtar gerekmez - aslında php bir uyarı ya da bildirimde rapor verecek

Eğer gerek yoksa 2) hata bastırma operatörü @, kullanmaktan kaçının

3) Ayrıca, <tr> etiketleri istedi, değil mi?

foreach($rowq as $value){
            echo "<tr><td>".$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.</td></tr>";
    }