2014-09-06 2 views
-1

안녕하세요, PHP 오류가 발생했습니다. "구문 분석 오류 : 예상치 못한 'endwhile'(T_ENDWHILE)의 C : \ wamp \ www \ index.php 32 행의 구문 오류.parse error

<?php 
include ('includes/db_connect.php'); 
$query = $db->prepare("SELECT post_id, title, body FROM posts"); 
$query->execute(); 
$query->bind_result($post_id, $title, $body); 
?> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="utf-8" /> 
<meta http-equiv="X-UA-Compatible" content="IE=9" /> 
<!--[if lt IE 9]> 
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></head>script> 
<![endif]--> 
<script scr="http://code.jquery.com/jquery-1.5.min.js"></script> 
</head> 
<style> 
    #container{ 
     margin:auto; 
     width:800px; 
    } 
</style> 
<body> 
<div id="container"> 
    <?php 
     while($query->fetch()); 
    ?> 
    <article> 
     <h2><?php echo $title ?></h2> 
     <p><?php echo $body?></p> 
    </article> 
    <?php endwhile?> 
</div> 
</body> 
</html> 

답변

2

변화율 : while($query->fetch());

행 : while($query->fetch()):

(결장 세미콜론)