에코가 나타나기 시작하는데 문제가 있습니다. 나는 거기에 문제가있는 것 같아 while
하지만 테이블은 mysql에 정상적으로 작동해야합니다. 이것은 내 코드`While` 에코가 보이지 않습니다.
<?php
$sql = $db->prepare('SELECT
topic_id,
topic_subject
FROM
topics
WHERE
topics.topic_id = :topid');
$sql->bindParam(':topid', $_GET['id'], PDO::PARAM_INT);
$sql->execute();
$result = $sql->rowCount();
if($result === FALSE){
echo 'The topic could not be displayed, please try again later.';
}
elseif(count($result) === 0){
echo 'This topic doesn′t exist.';
}
else
{
while($row = $sql->fetch())
{
//display post data
echo '<table class="topic" border="1">
<tr>
<th colspan="2">' . $row['topic_subject'] . '</th>
</tr>'; ?>
주제는 MySQL의 존재 때문에 while
가 표시되어야합니다. 내가 var_dump($sql->errorInfo());
을 사용할 때 array(3) { [0]=> string(5) "00000" [1]=> NULL [2]=> NULL }
null은 테스트로서 mysql에서 주제를 생성했기 때문이다.
그래서 스크립트는 무엇을 표시합니까? –
@ alessandro1997 이상하게 들리지만 아무것도 표시하지 않습니다 – jacmob