2012-01-09 4 views
0

각 항목 옆에 체크 박스가있는 목록을 만들고 싶습니다. 어떤 이유로 목록을 인쇄 할 수 있지만 확인란이 표시되지 않습니다.PHP 목록 및 체크 박스

$note = mysql_fetch_array($note_content); 

if($note['type'] == 'list') 
{ 
    $note_type='list';  

    print "<dl>"; 
    while($note = mysql_fetch_array($note_content)) 
    { 
     if($note['complete']) 
      echo "<strike>"; 
     echo "<dt>".$note['body']."</dt>"; 
     if($note['complete']) 
      echo "</strike>"; 
    } 
    print "</dl>"; 

    print "<dl style=\"float:right\">"; 
    while($note = mysql_fetch_array($note_content)) 
    { 
     echo "<dt> 
     <input type='checkbox' name='complete_goal' value='".$note['note_id']."'> 
     </input> 
     </dt>"; 
    } 
    print "</dl>"; 
} 
else 
{ 
    echo $note['body']; 
} 

답변

0

사용 mysql_data_seek({result set},{record#}) 배열의 상단에 결과를 재설정합니다.

0

mysql_fetch_array은 내부 데이터 포인터를 앞쪽으로 이동시킵니다. 두 번째 while 문에 $note = mysql_fetch_array($note_content) 대신 reset($note)을 입력하십시오. 이렇게하면 내부 포인터가 첫 번째 데이터 요소로 설정됩니다. 그런 다음 재 처리를 할 수 있도록 while($note = mysql_fetch_array($note_content)) 또는 다른 배열 처리와 루프

EG: 
mysql_data_seek($note_content, 0) 
("0" represents the first record in the array.) 

이 잠시 두 번째 전에

+0

이렇게하면 무한 루프가 반복됩니다. –