2011-02-11 4 views
1

오류에서 모든 날짜 항목 datebase에서 모든 날짜 항목 : datebase에오류 쇼에 datebase

:

Title1 
Title2 
Title3 

PHP 코드 :

$postdb = mysql_query("SELECT * FROM wtable"); 
$post = mysql_fetch_assoc($postdb); 

while ($poste = @mysql_fetch_array($postdb)) 
    { 
    echo $poste['posttitle']; 
    echo "<br />"; 
    } 

출력 :

Title2 
Title3 
+1

의견이 줄을'// $ 포스트 = mysql_fetch_assoc ($의 postdb)' 당신이 이미 인출 된 첫 번째 행 그러나이 –

+1

+ 생산처럼 에코되지 않았고, 그 추악한 악을 제거하기 때문에 @ 운영자. –

+0

무엇? 왜 ? 어떻게? – Abudayah

답변

3

첫 번째 결과를 반환 한 다음 커서를 앞으로 이동합니다.

이 줄을 주석 처리하고 다시 시도하십시오.

예 :

$postdb = mysql_query("SELECT * FROM wtable"); 
//$post = mysql_fetch_assoc($postdb); <-- comment out this line 

while ($poste = mysql_fetch_array($postdb)) { // <-- don't use @ here, we want to know if something went wrong! 
    echo $poste['posttitle']; 
    echo "<br />"; 
}